I need help with a for loop.

2 views (last 30 days)
Charles
Charles on 15 Jul 2014
Commented: Ashish Gudla on 5 Aug 2014
I have used the FFT to deconstruct a signal. Now i need to use the given data to reconstruct the waveform with the data extrapolated from the FFT.
I have manually reconstructed a the peeks by assigning variables.
ie. p15=(2.35/141)*sin(2*pi*15*70.922*t-2.94);
However there are 141 data points. The equation in need to program would be (MagFFT/141)*sin(2*pi*BIN#*70.992*t-Phase)
So MagFFT is a variable that corresponds to the magnitued determined from the fft. I need the Bin number to multiply by the change in frequency (70.992)
And finally the variable Phase needs needs to be entered into the eqution aswell.
So hopfully this is clear
I need a for loob to the work the following equation
A*sin(2*pi*B*(70.992)*t+C)
A=MagFFT=Magnitude from FFT B=Bin number C=Phase=phase is a defined variable.
I have attached the session below i that is helpfull.
  1 Comment
Ashish Gudla
Ashish Gudla on 5 Aug 2014
Assuming all you are trying to do is apply the equation for each value in the vector, you could probably do something like this
result = A.*sin(2*pi.*B.*(70.992).*t + C);

Sign in to comment.

Answers (0)

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!