Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In this task you must implement the matrix-vector form of the discrete fourier t

ID: 2250214 • Letter: I

Question

In this task you must implement the matrix-vector form of the discrete fourier transform as described in class. To do this, you must write two MATLAB functions x_jw-myfft (x_n) and x_n-myifft (x_jw) which must reside in their own MATLAB files: myfft.m and myifft.m respectively. The function x_jw-myfft (x_ n) implements the discrete fourier transform by computing the matrix WN and multiplying this matrix times the signal, x_n, which is assumed to be a column vector. The result is a column vector which is the discrete Fourier transform of the input, x_jw. The function x_n-myifft (x _jw) implements the inverse discrete Fourier transform by computing the matrix W-v and multiplying this matrix times the signal, x_jw, which is assumed to be a column vector. The result is a column vector which is the inverse discrete Fourier transform of the input, x _n. Test your DFT functions using a MATLAB script project2.m: I. Generate a sinusoidal sequence x[n] = cos(Sn) 0

Explanation / Answer

close all;

clear all;

xn=input('Enter the arrangement x(n)'); %Get the succession from client

ln=length(xn); %find the length of the arrangement

xk=zeros(1,ln); %initialize a variety of same size as that of info succession

ixk=zeros(1,ln); %initialize a variety of same size as that of information arrangement

%code square to discover the DFT of the grouping

i=sqrt(- 1);

% - - - -

for k=0:ln-1

for n=0:ln-1

xk(k+1)=xk(k+1)+(xn(n+1)*exp((- i)*2*pi*k*n/ln));

end

end

% - - - -

%code square to plot the information succession

% - - - -

t=0:ln-1;

subplot(221);

stem(t,xn);

ylabel ('Amplitude');

xlabel ('Time Index');

% - - - -

magnitude=abs(xk); % Find the sizes of individual DFT focuses

%code square to plot the size reaction

% - - - -

t=0:ln-1;

subplot(222);

stem(t,magnitude);

ylabel ('Amplitude');

xlabel ('K');

% - - - -

phase=angle(xk); % Find the periods of individual DFT focuses

%code piece to plot the greatness succession

% - - - -

t=0:ln-1;

subplot(223);

stem(t,phase);

ylabel ('Phase');

xlabel ('K');

% - - - -

% Code piece to discover the IDFT of the grouping

% - - - -

for n=0:ln-1

for k=0:ln-1

ixk(n+1)=ixk(n+1)+(xk(k+1)*exp(i*2*pi*k*n/ln));

end

end

ixk=ixk./ln;

% - - - -

%code piece to plot the information grouping

% - - - -

t=0:ln-1;

subplot(224);

stem(t,ixk);

ylabel ('Amplitude');

xlabel ('Time Index');

clc;

clear all;

close all;

[filename, pathname, filterindex] = uigetfile( ...

{ '*.jpg','JPEG (*.jpg)'; ...

'*.bmp','Windows Bitmap (*.bmp)'; ...

'*.fig','Figures (*.fig)'; ...

'*.*', 'All Files (*.*)'}, ...

'Pick image(s) to be handled', ...

'MultiSelect', 'off');

on the off chance that filterindex==0, break;end

filename=cellstr(filename);

im2= imread(horzcat(pathname,char(filename)));

im1=rgb2gray(im2);

im3=im2double(im1);

[n,m]=size(im3);

c1=0;

h = waitbar(0,'Calculating DFT please wait......');

k=1;l=1;

for l=0:1:m-1

for k=0:1:n-1

for x=0:1:n-1

for y=0:1:m-1

a=x+1;b=y+1;

c= im3(a,b) * exp(- 1i*2*pi*(k*x/n + l*y/m));

c1=c1+c;

end

end

aa=l+1;bb=k+1;

im(bb,aa)=c1;

c1=0;

end

waitbar(l/m);

end

ims = im*255;

close(h)

imshow(ims);title('dft plot');

% figure

d=ifft2(im);

figure

imshow(log(abs(ims)),[-1 5]); colormap(jet); colorbar;title('absolute estimation of dft plot');

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote