??? Undefined function or method 'sign' for input arguments of type 'sym'.
Mostra commenti meno recenti
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 Commento
Walter Roberson
il 25 Ago 2013
There is no such thing as an "if loop". There are "for loop" and "while loop" and "if statement".
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Common Operations in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!