how to keep a variable constant and other variable will change between two variable in the same code?
4 次查看(过去 30 天)
显示 更早的评论
( I'm new here. If I make any mistake, please consider it.)
I got my solution with two variable. I want to draw 3D curve. where it holds two conditions.
1) Where a and b both are constant. I did this code:
x=0:.01:2;
y=0:.01:2;
b=0.5;[X, Y]=meshgrid(x, y);
uxy=zeros(size(X));
a=1;
m=a^2;
pn=(16*m*sinh(pi*Y/2*a).*cos(pi*X/2*a))/(pi^3*sinh(pi*b/2));
uxy=(m- X.^2)/2-pn;
surf(X, Y,uxy)
Is it right or wrong? If not, then how can I do it?
2) I want to keep b as a constant. but var=a will change. I did this code:
x=0:.01:2;
y=0:.01:2;
b=0.5;
[X, Y] = meshgrid(x, y);
uxy=zeros(size(X));
for a=1:2
m=a^2;
pn=(16*m*sinh(pi*Y/2*a).*cos(pi*X/2*a))/(pi^3*sinh(pi*b/2));
uxy=(m- X.^2)/2-pn;
end
surf(X, Y, uxy)
Is it right or wrong? if not, then how can I do it?
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fit Postprocessing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!