i need the exact correct matlab codes for the solution of the question written b
ID: 3345120 • Letter: I
Question
i need the exact correct matlab codes for the solution of the question written below, please try to write the codes for each step seperately..
Consider the function f(x)=sin(x)-cos(x),
(A) Find the complex Fourier series of f(x)
(B) Discretize f(x) on [0,2*pi] for n=4 and find its Discrete Fourier Transform.
(You need to write F4 to calculate DFT of f(x).)
(C) Find the Discrete Fourier Transform of f(x) for n=4 by using MatLab and compare with your solution in (B). Explain your answer. (MatLab uses fft command for Discrete Fourier Transform and ifft command for inverse Discrete Fourier Transform.)
Explanation / Answer
This is the Matlab code (just 1 line (can write on command window)):
x = 0:3; f = sin(2*pi*x/4) - cos(2*pi*x/4); F = fft(f, 4); disp(F);
This is the answer given by Matlab:
F =
0.0000 -2.0000 - 2.0000i 0.0000 -2.0000 + 2.0000i
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.