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)-2​u(t-4)+r(-​t-5)

73 ビュー (過去 30 日間)
Since the question contains both step and ramp, how to write the code for it?
  11 件のコメント
Walter Roberson
Walter Roberson 2022 年 11 月 24 日
piecewise requires the Symbolic Toolbox

サインインしてコメントする。

採用された回答

Birdman
Birdman 2017 年 11 月 20 日
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.

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by