Monday, 28 November 2011

Write a MATLAB script to Substract two Given Signal

Write a matlab script to substract two given signal.


MATLAB SCRIPT

function [2,N]=Substracting (x,a,x2,b)

x1=input ('enter sequence1');
x2=input ('enter sequence2');
a=input ('a');
b=input ('b');


n11=min(a);
n21=min(b);
n22=max(b):

subplot (2,2,1);
stam (a,x);
x lable ('x-axis');
y lable ('y-axis');
title ('sequence1');
subplot (2,2,1);
stam (b,x2);
x-lable ('x-axis');
y-lable ('y-axis');
title ('sequence');
k=abs(n11)-abs(n21);
p=abs(k);
if(k>0)

x2= [zeros(1,p),x2];

else
x1= [zeros(1,p),x1];
end;

r=abs(s);
if(s>0):
x2=[(x2,zeros(1,r)];
else
x1=[(x1,zeros(1,r)];
end

z=x1+x2;
if[abs(n11) > abs(n21)]

n1=n11;

else
n1=n21;
end
if [abs (n12)> abs(n22)]

n2=n21;
else
n2=n22;
end
n=[n1 n2]

subplot (2,2,3);
stem (n,2);
title ('resultant sequence');


result: they we have done the substract of two discreate signals'

discussions:


1. proper looking of commands should be own
2.put commons & sem collumns at right place
3.no . of divison should be to the graph.

No comments:

Post a Comment