FFT analyzing of signal and signal reconstrution. (I want to reconstruct by suming a*sin(w*t-phi)
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
% I built a square wave simply by writing a file from 0-0.0128 for time and amplitude of 1 and -1. after analyzing with the fft %fuction. I want to reconstruct the Sqare wave by summing, not the IFFT function. The following code is how I did it. However, there %seems to be a missing cos(x) component. What am I missing?
figure(20)
plot(timesimple,simpleamp)
Simple=fft(simpleamp);
MagSimple=abs(Simple);
PhaseS=angle(Simple);
figure(21)
plot(MagSimple)
title('Square Wave FFT')
dsf=1/(.0001*64);
SimpFreq=(timesimple/.0001)*dsf;
ResultS=0;
for loop=1:64
a=MagSimple(loop)/64;
b=loop*78.1250;
c=PhaseS(loop);
ResultS=ResultS+a*sin(2*pi*b*timesimple+c);
end
figure(22) plot(ResultS)
0 Commenti
Risposte (1)
Daniel kiracofe
il 17 Ago 2014
You forgot the negative frequencies. You didn't state explicitly the definition of simpleamp, but I think length(Simple) should be 128. In this case loop need to run from 1:128, and SimpFreq should include both the positive and negative frequencies. You might look at fftshift().
0 Commenti
Vedere anche
Categorie
Scopri di più su Fourier Analysis and Filtering in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!