How do I plot the surface plot and surface plot based on the equation and conditions below?

조회 수: 4 (최근 30일)
I am plotting a temperature distribution
1.PNG
Conditions stated are 10 < a < 20 and 5 < b < 10.
The output needs me to display surface plot and contour plots.

채택된 답변

Ollie A
Ollie A 2019년 1월 30일
a = 15;
b = 7.5;
k = 4*100/pi; % Define constants.
X = linspace(-5,5,101);
[x,y] = meshgrid(X,X); % x and y range.
n = 1:2:199;
for p = 1:length(n)
u(:,:,p) = (sin(n(p)*pi*x/a).*sinh(n(p)*pi*y/a))./(n(p)*sinh(n(p)*pi*b/a)); % Distribution over all values of n.
end
u = k.*sum(u,3);
figure(1)
surf(x,y,u) % Surface plot.
figure(2)
contour(x,y,u) % Contour plot.
This produces the surface plot and contour plot you might be looking for. I have choosen an arbitrary range for x and y, and made sure a and b satisfy the conditions you specified.
  댓글 수: 1
Glucose Cube
Glucose Cube 2019년 1월 30일
Hey, thanks for your help!!! May I know how do I mention peoples in Mathworks? I cant @somebody'sname like social medias. Any help would be grateful

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by