??? Undefined function or method 'sign' for input arguments of type 'sym'.
이전 댓글 표시
I am trying to generate a wave :
when time=0:5 then r(t)=1
when time=5:10 then r(t)=2
when time=10:15 then r(t)=1
and then I also want to take derivative of this wave (even double derivative also)
I tried it without giving t=0:15 and with syms
code:
t= 0:0.1:14.9;
aaa=sin(2*pi*0.1*t');
% %r = [1,zeros(120,1)]+2-sign(aaa);
r =2.000-sign(aaa);
size(r)
r1=diff(r,t);
size(r1)
rp=horzcat(0,r1);
size(rp)
size(t)
plot(t',rp)
------
error:when time=0:5 then r(t)=1
I also tried with if loop ,
if t>=0 && t<=5
r=1;
if t>=5 && t<=10
r=2;
if t>=10 && t<=15
r=1;
this aslo doesnot work; give some logical error message
please help
댓글 수: 1
Walter Roberson
2013년 8월 25일
There is no such thing as an "if loop". There are "for loop" and "while loop" and "if statement".
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Common Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!