Posts

Showing posts with the label time shifting

Arithmetic operations of different discrete time signals. I. Time Shifting II. Folding/ Symmetry of the signal III. Addition IV. Multiplication V. Time scaling in MATLAB

Image
  MATLAB Program to verify the time-shifting property of discrete time signals where, x1[n] = {1, 0 ,1,0} & x2[n] = {1,2, 1 ,2} (underline indicates the value at the zero index) by plotting:  A. x1[n]+x2[n]  B. x1[n].*x2[n]  C. x1[-n+2]  D. x2[-n-2]  E. x1[-n+2].*x2[-n-2] Copy and paste the following program code in the Editor to run the program. Program Code: % Plot of the two discrete sequences n1 = [-1:2]; x1 = [1 0 1 0]; subplot(4,2,1); stem(n1,x1); xlabel('time index'); ylabel('amplitude'); title('discrete time sequence of x1'); axis([-2 2 0 3]); n2 = [-2:1]; x2 = [1 2 1 2]; subplot(4,2,3); stem(n2,x2); xlabel('time index'); ylabel('amplitude'); title('discrete time sequence of x2'); axis([-2 2 0 3]); % Addition of the two sequences n3 = [min(min(n1,n2)):max(max(n1,n2))]; z1 = [zeros((length(n3)-length(x1))),x1]; z2 = [x2,zeros((length(n3)-length(x2)))]; z3 = z1 + z2; subplot(4,2,5); stem(n3,z3); xlabel('time index'); yla...