21.01.2015 Views

COMSOL Multiphysics™

COMSOL Multiphysics™

COMSOL Multiphysics™

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

geomsurf<br />

Purpose<br />

geomsurf<br />

Create 3D geometry surface using height data defined on a grid.<br />

Syntax<br />

f = geomsurf(x,y,z)<br />

f = geomsurf(z)<br />

s = geomsurf(x,y)<br />

Description f = geomsurf(x,y,z) creates a 3D face object f on the grid defined by x and y,<br />

using z as height data. The surface created is identical in shape to the surface created<br />

with the scripting command surf(x,y,z).<br />

geomsurf uses piecewise bilinear interpolation, as does surf.<br />

f = geomsurf(z) creates a 3D face object f, corresponding to the call surf(z).<br />

s = geomsurf(x,y) creates a 2D solid object s corresponding to the syntax f =<br />

geomsurf(x,y,z) with z all zeros.<br />

Example<br />

% Create randomly generated surface<br />

% Create rectangular grid<br />

[x,y]=meshgrid(-0.1:0.2:1.1,-0.4:0.2:0.4);<br />

% Initialize random generator<br />

randn('state',1);<br />

% Create random height data<br />

z=0.1*randn(size(x));<br />

% Create 3D surface<br />

f=geomsurf(x,y,z);<br />

% Plot the surface<br />

geomplot(f)<br />

% Create approximation to a catenoidal surface<br />

% Create grid in spherical coordinates<br />

[theta,phi]=meshgrid(pi/8:pi/32:3*pi/8,pi/4:pi/32:pi/2);<br />

% The conical surface is expressed in spherical coordinates<br />

r=1;<br />

x=r.*cos(theta)./sin(phi);<br />

y=r.*sin(theta)./sin(phi);<br />

z=r.*log((1+sin(phi))./sin(phi));<br />

% Now, create the piecewise bilinear<br />

% approximative surface<br />

catenoid=geomsurf(x,y,z);<br />

% Plot the surface<br />

geomplot(catenoid)<br />

axis equal<br />

See Also<br />

face3, meshgrid<br />

240 | CHAPTER 1: COMMAND REFERENCE

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!