필터 지우기
필터 지우기

plus-minus function surf graph

조회 수: 2 (최근 30일)
Sean Smith
Sean Smith 2011년 9월 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)

채택된 답변

Honglei Chen
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
  댓글 수: 1
Sean Smith
Sean Smith 2011년 9월 30일
thank you, HUGE help.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by