**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:

**% 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 ');**

**subplot(3,2,1);**

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

**subplot(3,2,2);**

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

**% ADDITION**

**disp('sum of two signals : ');**

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

**subplot(3,2,3);**

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

**% SUBTRACTION**

**disp('difference of two signals : ');**

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

**subplot(3,2,4);**

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

**%MULTIPLICATION**

**disp('product of two signals: ');**

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

**subplot(3,2,5);**

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

**%SCALING**

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

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

**subplot(3,2,6);**

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

## No comments:

## Post a Comment

Your Comments... (comments are moderated)