I'm trying to get this function to plot but the actual figure won't come up. The script is running but the figure itself wont come up, I tried to put figure() but still nothing
N=5;
NTime=1000;
dt = 2/NTime;
t=--dt;
for k=1:NTime
t=t+dt;
time(k)=t;
f(k)=0;
for i=1:N
f(k)=f(k)+((-2/i*pi)*((-1)^i)/sqrt((1-(2*i*pi/2))^2+(2*0.05*2*i*pi/2)^2))*sin(2*i*pi*t);
end
end
plot(time,f,'r-')
hold on
axis([0 2 -1.5 1.5])

댓글 수: 3

the cyclist
the cyclist 2019년 9월 26일
Your code generates a figure for me. Have you tried with a fresh MATLAB session?
Geoff Hayes
Geoff Hayes 2019년 9월 26일
Parker - have you already run the code so that the figure appears, then when you go to run the code again (without closing the figure), it doesn't re-appear? Because the figure might be behind the MATLAB app. Try closing all figures with
close all;
before your code.
Parker Osburg
Parker Osburg 2019년 9월 26일
Update, all i had to do was refresh and clear the workspace, i think I just had too much going on on without refreshing. Thanks all!

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

제품

질문:

2019년 9월 25일

댓글:

2019년 9월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by