フィルターのクリア

How to plot 2D graph

1 回表示 (過去 30 日間)
Onur Metin Mertaslan
Onur Metin Mertaslan 2021 年 1 月 20 日
コメント済み: Star Strider 2021 年 1 月 21 日
Hi,
Here is the question;
and I want to calculate plot x-t-F graph for first 100 terms of n.
Sum=0;
for t=1:20
for x=1:20
for n=1:100
Sum=Sum+(30/pi)*(1/n)*(exp(-(n^2)*(pi^2)*1.14*t/3600))*(1-cos(n*pi/2))*(sin(n*pi*x/60));
end
end;
sum(t)=Sum;
end;
Here is my code. I am quite new in matlab and I wanted to do it with for loops. I want to ask that is there any way to take the values of x and t randomly between intervals and find the F function for each time and plot them?
Thank you!

採用された回答

Star Strider
Star Strider 2021 年 1 月 20 日
If I understand correctly what you want to do, this should work:
for t=1:20
for x=1:20
Sum=0;
for n=1:100
Sum=Sum+(30/pi)*(1/n)*(exp(-(n^2)*(pi^2)*1.14*t/3600))*(1-cos(n*pi/2))*(sin(n*pi*x/60));
end
accsum(x,t)=Sum;
end
end
figure
meshc((1:20),(1:20),accsum)
grid on
xlabel('x')
ylabel('t')
zlabel('F(x,t)')
view(-130, 30)
.
  2 件のコメント
Onur Metin Mertaslan
Onur Metin Mertaslan 2021 年 1 月 21 日
Yes, thank you very much. This is what I am exactly looking for.
Star Strider
Star Strider 2021 年 1 月 21 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by