mesh grid and mesh ploting

11 views (last 30 days)
H-M
H-M on 5 May 2020
Commented: H-M on 6 May 2020
R = 0.003/2;
y=linspace(-1,1,30);
x=linspace(-1,1,30);
r.^2==x.^2+y.^2;
y=r./R;
a0=-6536;
z=a0*R^2*(1-y.^2)/0.016;
[X1,Y1]=meshgrid(x,y);
%zz=griddata(x,y,z,X1,Y1,'cubic');
figure
mesh(X1,Y1,z)
This is a simple poiseuelle flow in a pipe, my goal is to plot the velocity of flow(z) in 3D. R is the redius of pipe, x and y are inplane and z is the velocity along the pipe length. I get the error ' Error using mesh Z must be a matrix, not a scalar or vector.' How can I get the z as a matrix to resolve the error?
  3 Comments
David Hill
David Hill on 6 May 2020
Do you have the equations you are trying to model? Or are you creating the model yourself?

Sign in to comment.

Answers (1)

H-M
H-M on 6 May 2020
I just have the poiseuille velocity equation(z equation in my code) in a circular pipe and I am supposed to plot the velocity profile in 3D with meshgrid.
  1 Comment
H-M
H-M on 6 May 2020
x and y are 30*30 matrix but z is 1*30 matrix. z should be a 30*30 matrix

Sign in to comment.

Categories

Find more on Computational Fluid Dynamics (CFD) in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!