DSP MATLAB Code : MATLAB Script for Linearity property of DFT

clc;
x1 = input('x1[n]= 'wink;
x2 = input('x2[n]= 'wink;
a1 = input('a1 = 'wink;
a2 = input('a2 = 'wink;
n1 = length(x1);
n2 = length(x2);
N = max(n1,n2);
x1 = [x1 zeros(1,N-n1)];
x2 = [x2 zeros(1,N-n2)];
y1 = a1.*x1 + a2.*x2;
Y1 = fft(y1,N);
X1 = fft(x1,N);
X2 = fft(x2,N);
Y2 = a1*X1 + a2*X2;
disp('Output of left side DFT(a1*x1 + a2*x2) is:'wink;
disp(Y1);
disp('Output of right side a1*X1 + a2*X2 is:'wink;
disp(Y2);
Posted by makeale 01/05/2015 08:52 PM Comments
 

Archives