Clear Filters
Clear Filters

x(t) = Λ(t/4)[Π((​t+4)/6)+Π(​(t-4)/6)]+​Λ(t), t = [-10,10]

1 view (last 30 days)
milton
milton on 6 Nov 2020
Commented: milton on 11 Nov 2020
Hi,
I am new in MatLab and I am having some trouble plotting the above x(t)using the rectpuls and i'm not sure where i am going wrong. By default the code must be like that:
step = 0.01;
t =
xt =
figure(1)
I tried the below code but something is wrong with the tripuls's arguments.[Ihave seen that it's form is tripuls(t,w,s), where w is the width where here is 0.25? and s is the skew, where here is ...?]. In the paper I have found that: Π((t+4)/6)+Π((t-4)/6) = Π(t/6+4/6)+Π(t/6-4/6) = Π(t/(2*3)) + Π(4/6) + Π(t/(2*3) - Π(4/6) =[ Π(4/6) = 0]=u(t+3) - u(t-3) - u(t+3) + u(t-3) = 0. So finally x(t) = Λ(t), but what about the code?
step = 0.01;
t = -10:step:10;
syms t
xt = tripuls(t,0,1)*((heaviside((t+4)/6)+heaviside((t-4)/6)))+ tripuls(t);
figure(1)
fplot(t,xt);
  4 Comments
Debasish Samal
Debasish Samal on 10 Nov 2020
Edited: Debasish Samal on 10 Nov 2020
Hi,
The 'tripuls' function accepts input arguments of type 'single' or 'double' but it is 'symbolic' in this case. Can you try using these data types instead?
If you want to plot unit step function without 'Heaviside', an example can be found in the following MATLAB Answer:
-Debasish
milton
milton on 11 Nov 2020
Thank you, Debasish Samal! It was really helpful the MATLAB Answer that you post!

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!