Monday, April 19, 2010

Plotting Continuous Signal #1 - Unit Step Function

x(t) = 4u(t) + 2sin(3t)




Matlab's inline function is convenient for creating unit step function.

Code :
t = -pi:0.01:pi;
u = inline('t >= 0');  
y = 4*u(t) + 2*sin(3*t);

plot(t,y,'r');grid on;
axis([-4 4 -3 7]);
xlabel('t'); ylabel('x(t)');
title('x(t) = 4u(t) + 2sin(3t)')

(From exercise 1C, chapter 1, book Fundamentals of Signals and Systems, 2nd ed. (Edward W. Kanen, Bonnie S. Heck))

No comments:

Post a Comment