From one of the problem in here :
I've got some clue from here. So, here is my solution :
t = -5:0.01:5; % total range of the graph q1 = t<-4; % range 1q2 = t>=-4 & t<3; % range 2
q3 = t>=3; % range 3 y = zeros(size(t)); % initialization y(q1) = 0; % curve 1 y(q2) = t(q2) + 2; % curve 2 y(q3) = t(q3) - 2; % curve 3 plot(t,y); axis([-5 5 -4 7])
And here is the graph :
Okay. The x(t) above is quite simple. How if it is --in example-- an polynomial equation? The concept remains the same. But, don't forget to use the dot operator, because we will power each of array member.
No comments:
Post a Comment