Question

In: Computer Science

Hello, I need the Matlab code of the Fourier Transform without using the Matlab functions fft...

Hello, I need the Matlab code of the Fourier Transform without using the Matlab functions fft and dft. Applied to discrete signals. If you can with an example.Thank you!!

Solutions

Expert Solution

Program :

clc;
clear all;
x = input('Enter the input sequence = ');
N = length(x);
for k = 1:N
y(k) = 0;
for n = 1:N
y(k) = y(k)+x(n)*exp(-1i*2*pi*(k-1)*(n-1)/N);
end
end
%code block to plot the input sequence
t = 0:N-1;
subplot(2,2,1);
stem(t,x);
ylabel('Amplitude ---->');
xlabel('n ---->');
title('Input Sequence');
grid on;
magnitude = abs(y); % Find the magnitudes of individual FFT points
disp('FFT Sequence = ');
disp(magnitude);
%code block to plot the FFT sequence
t = 0:N-1;
subplot(2,2,2);
stem(t,magnitude);
ylabel('Amplitude ---->');
xlabel('K ---->');
title('FFT Sequence');
grid on;
R = length(y);
for n = 1:R
x1(n) = 0;
for k = 1:R
    x1(n) = x1(n)+(1/R)*y(k)*exp(1i*2*pi*(k-1)*(n-1)/R);
end
end
%code block to plot the IFFT sequence
t = 0:R-1;
subplot(2,2,3);
stem(t,x1);
disp('IFFT Sequence = ');
disp(x1);
ylabel('Amplitude ---->');
xlabel('n ---->');
title('IFFT sequence');
grid on;

Output :

Enter the input sequence = [1 4 2 5 2]

FFT Sequence =
   14.0000    2.8124    4.3692    4.3692    2.8124

IFFT Sequence =
Columns 1 through 4

   1.0000 - 0.0000i   4.0000 - 0.0000i   2.0000 - 0.0000i   5.0000 + 0.0000i

Column 5

   2.0000 + 0.0000i

Waveforms:

  


Related Solutions

Find the Fast Fourier Transform (FFT) of some functions by MATLAB and interpret them. Change the...
Find the Fast Fourier Transform (FFT) of some functions by MATLAB and interpret them. Change the sampling frequency to observe the aliasing.
(TCO 7) What is the difference between discrete Fourier transform (DFT) and fast Fourier transform (FFT)?...
(TCO 7) What is the difference between discrete Fourier transform (DFT) and fast Fourier transform (FFT)? can you please type it cant see images.
Using Matlab Simulink, find Fourier transform of the following signal; ?(?) = 2 + ∑ 1...
Using Matlab Simulink, find Fourier transform of the following signal; ?(?) = 2 + ∑ 1 ? sin (20???) 4 ?=1 . Set simulation stop time = 20 seconds, sample time = (1/1024) seconds, buffer size =1024, and frequency range in Hz for the vector scope is −100 ≤ ? ≤ 100
Matlab code problems I have to write a code using functions to find out if a...
Matlab code problems I have to write a code using functions to find out if a year is a leap year. I'm on the write track i feel like but I keep getting an error message and matlab isnt helping to troubleshoot. The issue is on line 30. Here is my code: function project_7_mfp() %   PROJECT_7_ABC   project_7_abc() creates a function that prompts the user %   enter a year after 1582 It then determines if it is a leap year %...
Given the following functions, can you have the corresponding a) Fourier series, b) Fourier transform and...
Given the following functions, can you have the corresponding a) Fourier series, b) Fourier transform and c) Laplace transform? If yes, find them, if not, explain why you can not. A, x(t) = -1+cos(2t) + sin(pai*t+1)                                               (4-1) B, x(t) = 2d(t) cos(2t) +d(t-1.5p) sin(2t)                                          (4-2) C, x(t) = 1+cos(1.5t) + cos(4t)                                           (4-3)
Given the following functions, can you have the corresponding a) Fourier series, b) Fourier transform and...
Given the following functions, can you have the corresponding a) Fourier series, b) Fourier transform and c) Laplace transform? If yes, find them, if not, explain why you can not. A, x(t) = -1+cos(2t) + sin(pt+1)                                                                                 (4-1) B, x(t) =2d(t) cos(2t) +d(t-1.5p) sin(2t)                                                                    (4-2) C, x(t) = 1+cos(1.5t) + cos(4t)                                                                                    (4-3)
I need matlab code for digital watermarking using SVD. Please explain each step
I need matlab code for digital watermarking using SVD. Please explain each step
Both the Fourier Series and the Discrete Fourier Transform are calculated using summation. Explain the key...
Both the Fourier Series and the Discrete Fourier Transform are calculated using summation. Explain the key differences in what the inputs each of the Fourier Series and the DFT are AND the requirements the inputs.
For these of string functions, write the code for it in C++ or Python (without using...
For these of string functions, write the code for it in C++ or Python (without using any of thatlanguage's built-in functions) You may assume there is a function to convert Small string into the language string type and a function to convert your language's string type back to Small string type. 1. int [] searchA,ll(string in...str, string sub): returns an array of positions of sub in in...str or an one element array with -1 if sub doesn't exist in in...str
i need matlab code of heat equation in 1D with convection ?
i need matlab code of heat equation in 1D with convection ?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT