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

Geoff Hayes
Geoff Hayes 2020년 6월 16일
Moslem - please clarify what you mean by failed to generate plot. Were any plots generated or none? Or just one? Or do you see an error?
I also wonder if you mean for y to be a "sym".
Moslem Uddin
Moslem Uddin 2020년 6월 16일
It gives only only figure. Yes, y is symbolic.
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일

0 개 추천

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일

0 개 추천

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

카테고리

도움말 센터File Exchange에서 Graphics Performance에 대해 자세히 알아보기

제품

릴리스

R2016a

태그

질문:

2020년 6월 16일

댓글:

2020년 6월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by