Here is one way:
U = @(t) -(t<pi/2).*t + (t>=pi/2) * 0; % Don't really need that second term, since it is always zero
figure tt = 0:0.01:pi; plot(tt,U(tt),'.')

Here is one way:
U = @(t) -(t<pi/2).*t + (t>=pi/2) * 0; % Don't really need that second term, since it is always zero
figure tt = 0:0.01:pi; plot(tt,U(tt),'.')
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!