Plot surface in cylindrical coordinate system in matlab -


i have function , want plot on cylindrical coordinate.

w(z,theta)=sin(n.pi.z/a).sin(m.theta)  

the limits of variables are: z=0..a , theta=0..theta_0 , radius of cylinder r=1.

as physical sense can explain if in cartesian coordinate, z & theta x,y axis , w surface on rectangular domain. in cylindrical coordinate z & theta restrict 1 cylindrical piece of cylinder radius=1 w surface on domain.

plotting using cylindrical or spherical coordinates involves several steps:

  1. create vectors theta , z:

    theta = linspace(0,2*pi); z = linspace(0,10);

  2. create meshgrid theta , z:

    [th,z] = meshgrid(theta,z);

  3. write function r(th,z):

    r = sin(z)+1+5*sin(th); %// cylinder r = ones(size(z));

  4. convert cylindrical coordinates cartesian:

    [x,y,z] = pol2cart(th,r,z);

  5. plot result using surf, mesh or whatever:

    mesh(x,y,z); axis equal

this result get: enter image description here


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -