- Get link
- Google+
- Other Apps

- Get link
- Google+
- Other Apps

Program:

clc;

close all;

clear all

%Generate
the first sequence

L1=input('Enter input for lower value=');

H1=input('Enter input for higher value=');

n1=L1:H1

disp('Display the no. of samples value to be enter ')

L1=length(n1)

x=input('Enter a first sequence=')

subplot(2,2,1);

stem(n1,x);

title('X');

axis tight;

grid on;

%Generate
the Second sequence

L2=input('Enter input for lower value=');

H2=input('Enter input for higher value=');

n2=L2:H2

disp('Display the no. of samples value to be enter=');

L2=length(n2)

y=input('Enter a second sequence=');

subplot(2,2,2);

stem(n2,y);

title('Y');

axis tight;

grid on;

%Finding
the duration of output signal

n3=min(min(n1),min(n2)):max(max(n1),max(n2));

s1=zeros(1,length(n3));

s2=s1;

s1((n3>=min(n1))&(n3<=max(n1))==1)=x;

s2((n3>=min(n1))&(n3<=max(n1))==1)=y;

%Adding
operation

display('Addition of two sequence is= ');

add=s1+s2

subplot(2,2,3)

stem(n3,add)

title('Z=X+Y');

axis tight;

grid on;

%Subtracting
operation

display('subtraction of two sequence is= ');

sub=s1-s2

subplot(2,2,4)

stem(n3,sub)

title('Z=X-Y');

axis tight;

grid on;

- Get link
- Google+
- Other Apps

- Get link
- Google+
- Other Apps