How to sketch the following signal? x(t)= 3u(t-10)+ 4u(-t+3)-r(t+2)+4r(t)-2u(-t-2)-2r(t-3)-2u(t-4)+r(-t-5)
28 views (last 30 days)
Show older comments
Mohamed Mohamed
on 20 Nov 2017
Commented: Walter Roberson
on 24 Nov 2022
Since the question contains both step and ramp, how to write the code for it?
Accepted Answer
Birdman
on 20 Nov 2017
syms u(t) r(t) x(t) t0
u(t)=piecewise(t<t0, 0, t>=t0, 1);
r(t)=piecewise(t<t0, 0, t>=t0, t-t0);
t1=-6:0.01:10;
x(t)=3*u(t-10)+4*u(-t+3)-r(t+2)+4*r(t)-2*u(-t-2)-2*r(t-3)-2*u(t-4)+r(-t-5);
x=subs(x,{t0,t},{0,t1});
plot(t1,x)
Something like this should do it. Note that I defined the input range randomly. Hope this helps.
More Answers (0)
See Also
Categories
Find more on Entering Commands in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!