How can I draw multiple functions base on same t (time) but different intervals?
Show older comments
I have one main function dependent on t, like:
t=-1:0.1:12;
x=@(t) [(t).*((t >= 0)&(t<=3)) + (3*ones).*((t>3)&(t<=4)) + (2*ones).*((t>4)&(t<5)) + (2*(6-t)).*((t>=5)&(t<=6))];
Then I created several functions from this function, like:
a=x(t-4);
b=x(t+1);
c=x(3*t);
d=x(t/2);
Now I want to plot these functions in the one same graph, but I want every function in different t intervals because I don't want to see the functions where that are 0. It causes visual pollution to me. For exp:
I try fplot function to get over this. I succeed draw main function that I want but when I want to draw the other functions the result like this:

I don't understand why this occurs. But at the end I am open to any help.
Thanks for the replies.
2 Comments
darova
on 16 Mar 2021
Can't you do something like
plot(t+2,x(t))
yusuf kaya
on 18 Mar 2021
Accepted Answer
More Answers (0)
Categories
Find more on 2-D and 3-D Plots 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!