mesh grid and mesh ploting
이전 댓글 표시
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
David Hill
2020년 5월 5일
R = 0.003/2;
y=linspace(-1,1,30);
x=linspace(-1,1,30);
r=sqrt(x.^2+y.^2);%is this what you mean?
y=r./R;
[X1,Y1]=meshgrid(x,y);
z=(f1.a0)*R^2*(1-Y1.^2)/0.016;%if z only depends on y, move after the meshgrid to get z as matrix
figure
mesh(X1,Y1,z)
David Hill
2020년 5월 6일
Do you have the equations you are trying to model? Or are you creating the model yourself?
답변 (1개)
카테고리
도움말 센터 및 File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!