help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

rebuild signal from frequency domain to time domain tia sal22


From: Rick T
Subject: rebuild signal from frequency domain to time domain tia sal22
Date: Wed, 9 Mar 2011 01:45:19 -1000

rebuild signal from frequency domain to time domain tia sal22

Greetings all 

I would like to rebuild a signal from the frequency domain
can this be done using fft?  If so does anyone have some 
example code?

Here's what I have so far.  I create/import a signal and plot
using the time domain.  Then I use fft to convert to 
the frequency domain and plot.  What I want to do now is 
be able to convert from the frequency domain data back to the time
domain.  Then I'll be able to export the file as a wave file 

PS: I won't have an equation to work with because I'll be importing
an audio file, and I'll be making changes when the signal is
in the frequency domain.  

But at the moment I'm just trying to convert from the 
frequency domain back to the time domain. So the third plot 
when created would look just like the first plot in the time domain 
in the example below


%time domain

%create time domain
Fs = 1000;                    % Sampling frequency
T = 1/Fs;                     % Sample time
L = 1000;                     % Length of signal
t = (0:L-1)*T;                % Time vector
y = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t); 

%frequency domain
NFFT = 2^nextpow2(L); % Next power of 2 from length of y
Y = fft(y,NFFT)/L;
f = Fs/2*linspace(0,1,NFFT/2+1);

subplot(2,1,1),plot(Fs*t(1:50),y(1:50))
title('Signal ')
xlabel('time (milliseconds)')

% Plot  amplitude spectrum.
subplot(2,1,2),plot(f,2*abs(Y(1:NFFT/2+1))) 
title('Amplitude Spectrum of y(t)')
xlabel('Frequency (Hz)')
ylabel('|Y(f)|')

tia sal22

--


reply via email to

[Prev in Thread] Current Thread [Next in Thread]