You are on page 1of 9

Lab 9

63)
a
N=500;
k=0:N-1;
a=1;b=2;
w=pi*k/N;
x1=rand(1,11);
x2=rand(1,11);
X1=fft(x1,N);
X2=fft(x2,N);
x=a*x1+b*x2;
X3=fft(x,N);
X4=a*X1+b*X2;
figure;
plot(w,abs(fftshift(X3)));title('fourier transform of x=a*x1+b*x2');
xlabel('frequency');ylabel('magnitude');grid;
figure;
plot(w,abs(fftshift(X4)));title('fourier transform a*X1+b*X2');
xlabel('frequency');ylabel('magnitude');grid;
% inference
% linearity property is verified
%b
N=100;
k=0:N-1;
w=pi*k/N;
n=1:11;
x=zeros(1,100);
x(n)=rand(1,11);
y=zeros(1,100);
y(3:13)=x(1:11);
X=fft(x,N).*exp(1i*w*-2);
Y=fft(y,N);
figure;
stem(w,(abs(fftshift(X))));title('fourier transform x**exp(1i*w*-2)');
xlabel('frequency');ylabel('magnitude');grid;
figure;
stem(w,(abs(fftshift(Y))));
title('fourier transform of shifted signal x(n-2)');
xlabel('frequency');ylabel('magnitude');grid;
% inference

% sample shift property is verified


%c
N=500;
k=0:N-1;
w=pi*k/N;
x=rand(1,16)+1i*rand(1,16);
y=conj(x);
X=fft(x,N);
Y=fft(y,N);
figure;
stem(w,fliplr(abs(fftshift(X))));title('conjugate fourier transform)');
xlabel('frequency');ylabel('magnitude');grid;
figure;
stem(w,abs(fftshift(Y)));title('fourier transform x');
xlabel('frequency');ylabel('magnitude');grid;
%inference
% conjugation property is verified
%d
N=500;
k=-N/2:N/2-1;
w=pi*k/N;
x=rand(1,16);
y=fliplr(x);
X=fft(x,N);
Y=fliplr(fft(y,N));
figure;
stem(w,abs(fftshift(X)));title('fourier transform of x');
xlabel('frequency');ylabel('magnitude');grid;
figure;
stem(w,abs(fftshift(Y)));title('fourier transform flipped signal');
xlabel('frequency');ylabel('magnitude');grid;
% inference
% folding property is verified

q64
n=linspace(0,50,2000);
x=cos(0.05*pi*n);
H=filter([1],[1 -0.8],x);
plot(n,H);title('steady state response');
xlabel('time');ylabel('amplitude');grid;
% inference
% we can see slugish nature at the starting which is transient response and
% the remaining graph is the steady state response
% for frequency response complex sinusoids are used for good
% characterization of the system in frequency domain

q65
H=freqz([0.0181 0.0543 0.0543 0.0181],[1 -1.76 1.1829 1.1829 0.2781]);
w=linspace(0,100,length(H));
plot(w,abs(H));title('third order lowpass filter');
xlabel('frequency');ylabel('magnitude');grid;
% inference
% we can see low pass characteristics from the plotted graph

q66
n=0:10;
x=10*(0.8).^n;
N=length(x);
y(1)=x(1);
for k=2:11
y(k)=x(12-k);
end
figure;
subplot(2,1,1);
stem(n1,y);title('modulo of x');xlabel('time');ylabel('amplitude');grid;
subplot(2,1,2);
stem(n,x);title('x');xlabel('time');ylabel('amplitude');grid;
k=0:N-1;
w=k*pi/N;
figure;
subplot(2,1,1);
stem(w,abs(fftshift(fft(x))));title('fourier transform of x');
xlabel('frequency');ylabel('magnitude');grid;
subplot(2,1,2);
stem(w,abs(fftshift(fft(y))));title('fourier transform of y');
xlabel('frequency');ylabel('magnitude');grid;
% inference

% fourier transform of circular shifted signal and orginal signal is


% approximately same

Undefined function or variable 'n1'.


Error in lab9 (line 115)
stem(n1,y);title('modulo of x');xlabel('time');ylabel('amplitude');grid;

68)
n=0:10;
x=10*(0.8).^n;
n1=mod(n-6,15);
y=10*(0.8).^n1;
subplot(2,1,1);
stem(n1,y);title('modulo of x((n-6))|15');
xlabel('time');ylabel('amplitude');grid;
subplot(2,1,2);
stem(n,x);title('x');xlabel('time');ylabel('amplitude');grid;

q69
x=[1 2 2];y=[1 2 3 4];
x_pad = [x zeros(1,6-length(x))];
y_pad = [y zeros(1,6-length(y))];
circ = ifft(fft(x_pad).*fft(y_pad));
display (circ);
% inference
% using fourier transform convolution is found using duality principle

You might also like