필터 지우기
필터 지우기

Need help with Plotting inside a time loop please!

조회 수: 2 (최근 30일)
Vignesh Kumar
Vignesh Kumar 2016년 4월 21일
댓글: John BG 2016년 4월 22일
t = [0:100]; wavomega=0.5; f=100; if t>10 && t<15 Ft = f*sin(wavomega*t); else Ft =0; end figure; plot(Ft,t)
This gives an error and says t is not a scalar?? Please help how to plot this.? Is it because Ft is changing in every loop?
Please help.

답변 (2개)

John BG
John BG 2016년 4월 22일
Instead of the if, use directly
Ft=zeros(1,length(t))
Ft = f*sin(wavomega*t(11:14))
If you find this answer of any help solving your question, please click on the thumbs-up vote link, or mark it as accepted answer
thanks in advance
John

Vignesh Kumar
Vignesh Kumar 2016년 4월 22일
Thank John,
ITs not working. Says * matrix dimensions must match
  댓글 수: 1
John BG
John BG 2016년 4월 22일
Vignesh
this works:
t = [0:100];
wavomega=0.5;
f=100;
Ft=zeros(1,length(t))
Ft([11:14]) = f*sin(wavomega*t([11:14]));
stem(t,Ft)
is this ok? regards
John

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

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by