You are on page 1of 3

Murtaza Zafar 5285

Home Assignment
Question 1 %% Initializing close all clear all clc x=randn(1,1000); t=0:1:999; T=0:1:1998; subplot(311),plot(t,x) y=conv(x,x) subplot(312),plot(T,y) q=fft(x) subplot(313),plot(q)

Murtaza Zafar 5285 Question 2 %% Initializing close all clear all clc N = 8; %% number of sample t = [0:0.001:1]; %% define time a=0.5*sin(2*pi*2*t); b=2*cos(4*pi*3*t); c=sin(2*pi*2*t); d=cos(4*pi*3*t); e=dot(c,d) f=a+b+e q=fft(f) p = abs(q)/(N/2); %% absolute value of the fft z=ifft(q) subplot(3,2,1) plot(t,f) xlabel('Time on x axis') ylabel('Amplitude') title('Orginal signal') grid on subplot(3,2,2) plot(t,q) xlabel('Time on x axis') ylabel('Fourier Transform ') title('Transformed signal') grid on subplot(3,2,3) plot(t,real(q)) xlabel('Time on x axis') ylabel('Real Part') title('Real Part of the Fourier Transform') grid on subplot(3,2,4) plot(t,p) xlabel('Time on x axis') ylabel('Imiginary Part') title('Imiginary Part of the Fourier Transform') grid on subplot(3,2,5) plot(t,z) xlabel('Time on x axis') ylabel('Ampltiude') title('Original Signal') grid on

Murtaza Zafar 5285

You might also like