plus-minus function surf graph
2 次查看(过去 30 天)
显示 更早的评论
This all works fine when I just graph half of the equation Y (either the positive or negative side) but it gives me dimensions must agree error when I add Y=[Y -Y]. I'm not sure why. How do I plot the positive and negative results together?
clear
B=0.5;
L=4;
D=0.5;
x=linspace(-L/2,L/2,50);
z=linspace(-D,0,50);
[X,Z]=meshgrid(x,z);
Y=B/2*(1-(4*X.^2)./L^2)*(1-Z.^2./D^2);
Y=[Y -Y];
figure; surf(X,Y,Z)
0 个评论
采纳的回答
Honglei Chen
2011-9-30
Hi Sean,
If you just want to plot, you should do
figure;
surf(X,Y,Z);
hold on;
surf(X,-Y,Z);
HTH
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!