フィルターのクリア

Plotting with nested for loops

6 ビュー (過去 30 日間)
Moslem Uddin
Moslem Uddin 2020 年 6 月 16 日
コメント済み: Stephen23 2020 年 6 月 16 日
I have resolved the issue with the following code:
clc, clear all
syms y
t=[0 pi 2*pi];
a=[5 10];
for k=1:length(a)
for j=1:length(t)
f=a(k)*sin(t(j)*y);
fplot(y,f);hold on;
end
end
  3 件のコメント
Moslem Uddin
Moslem Uddin 2020 年 6 月 16 日
It gives only only figure. Yes, y is symbolic.
Stephen23
Stephen23 2020 年 6 月 16 日
Original question retrieved from Google Cache:
I want to plot multiple figures using nested for loop, but failed to generate plot. I used the following code:
clc, clear all
syms y
t=[0 pi 2*pi];
a=[5 10];
for k=1:length(a)
for j=1:length(t)
f=a(k)*sin(t(j)*y);
fplot(y,f);
end
end

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

採用された回答

Moslem Uddin
Moslem Uddin 2020 年 6 月 16 日
clc, clear all
syms y
t=[0 pi 2*pi];
a=[5 10];
for k=1:length(a)
for j=1:length(t)
f=a(k)*sin(t(j)*y);
fplot(y,f);hold on;
end
end

その他の回答 (1 件)

Rafael Hernandez-Walls
Rafael Hernandez-Walls 2020 年 6 月 16 日
syms y
t=[0 pi 2*pi];
a=[5 10];
for k=1:length(a)
for j=1:length(t)
f=a(k)*sin(t(j)*y);
figure %only with this line
fplot(y,f);
end
end

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

製品


リリース

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by