How to have square wave in Matlab symbolic equation -
my project require me use matlab create symbolic equation square wave inside. tried write no avail:
syms t; a=square(t); input arguments must 'double'.
what can solve problem? in advance helps offered.
here couple of general options using floor , sign functions:
f=@(a,t,x0,x) a*sign(sin((2*pi*(x-x0))/t)); f=@(a,t,x0,x) a*(-1).^(floor(2*(x-x0)/t)); so example using floor function:
syms x sqr=2*floor(x)-floor(2*x)+1; ezplot(sqr, [-2, 2]) 
Comments
Post a Comment