FFT analyzing of signal and signal reconstrution. (I want to reconstruct by suming a*sin(w*t-phi)

4 ビュー (過去 30 日間)
Charles
Charles 2014 年 8 月 13 日
回答済み: Daniel kiracofe 2014 年 8 月 17 日
% 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)

回答 (1 件)

Daniel kiracofe
Daniel kiracofe 2014 年 8 月 17 日
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().

カテゴリ

Help Center および File ExchangeFourier Analysis and Filtering についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by