* ************************************************* * To define a piecewise linear function and plot it * ************************************************* u = @(t) ((t>=0)*1.0); w = @(t, a, b) (u(t - a) - u(t - b)) x = @(t) (w(t,-1,0).*(-1-t) + w(t,0,1).*t + w(t,1,2).*1.0 + w(t,2,3).*(3-t)) figure tvec = -3:0.025:5; plot(tvec, x(tvec), 'b', tvec, x(-2*tvec-1), 'r'); ylim([-1.5 1.5]); * ***************************************** * To define a function x(t) = sin(5*t) * ***************************************** x = @(t) (sin(5*t)) tvec = -1:0.05:4; plot(tvec, x(tvec), 'b', tvec, h(3-tvec), 'r', 0, 0, 'ok', 3, 0, 'ok'), ylim([-1.5 1.5]) * ***************************************** I = eye(4); "**** Q1*******" z = 3.5e4; y = 4; y y = z; y "*************" "" hello