Basic operations on discrete time finite signals

  • Addition of two signals
  • Subtraction of two signals
  • Multiplication of two signals
  • Scaling of a signal

Algorithm: for all operations

  • Input the first signal sequence
  • Input the second signal sequence
  • Do the addition operation using MATLAB function "plus(x,y)" where x and y are the signals to be added
  • Plot the result
  • Do the subtraction operation using MATLAB function "minus(x,y)" where x is the signal from which the signal y has to be subtracted. Then plot the result
  • Do the multiplication operation using the MATLAB function "times(x,y)" where x and y are the signals to be multiplied.
  • Plot the resultant signal
  • Input the scaling factor
  • Do the scaling operation on the signal using MATLAB function "mtimes(a,x)" where a is the scaling factor and x is the signal to be scaled.
  • Draw the resultant signal


% Program to perform basic operation on discrete time finite signal

clear all ; % close all

x=input('Enter the value of first signal : ' );

N1=input ('Enter value for time axis ');

y=input ('Enter the value of second signal : ' );

N2=input ('Enter value for time axis ');


stem(N1,x); %plot the first sequence


stem(N2,y); %plot the second sequence


disp('sum of two signals : ');

disp(plus(x,y)); %do addition and display it


stem(N1,plus(x,y)); %plot the resultant signal


disp('difference of two signals : ');

disp(minus(x,y)); %do multiplication and display result


stem(N1,minus(x,y)); %plot the resultant signal


disp('product of two signals: ');

disp(times(x,y)); % display the product


stem(n!,times(x,y)); %plot result


a=input('Enter the scaling factor: ');

disp(mtimes(a,x)); % do scaloing & display it


stem(N1,mtimes(a,x)); %plot the resultant signal


No comments:

Post a Comment

Your Comments... (comments are moderated)