Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
How to convert frequency spectrum to time domain waveform
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hello everybody, There is one problem here i am getting. I have taken some data in labview then converted into project6.mat file and then applied following commands to get timewaveform signal figure file and its FFT spectrum figure file.
Then i modified/clipped/removed some signals in FFT spectrum figure file which are not required. Now i want to obtain the Time waveform Figure file as well as the .mat file converting data from the FFT figure file i have changed.......
Th code giving Time domain and FFT spectrum is
load Project6
x1 = x1(:,2); % samplerate=25600;
fs=samplerate;
n = length(x1);
t0 = 0; % initial time
tf = 1.28;% final time
tspan = 1/n;
ntspan =(tf-t0)*tspan;
t = (t0:ntspan:tf);
figure(1)
plot (t(1:32768),x1,'r','linewidth',1)
grid on
xlabel('Time (sec)','Fontname','Times new roman','FontSize',35,'fontweight','b')
ylabel('Amplitude (Volts)','Fontname','Times new roman','FontSize',35,'fontweight','b')
set(gca, 'FontName','Times New Roman','FontSize',35,'fontweight','b')
% % -----------------------------FFT ----------------------------------
out1=fft(x1,n)/n;
figure(2)
plot(fs/2*linspace(0,1,(length(out1)/2)+1),abs(out1(1:(length(out1)/2)+1)),'b','linewidth',4),title('One sided Spectrum','Fontname','Times new roman','FontSize',35,'fontweight','b')
grid on
xlabel('Frequency (Hz)','Fontname','Times new roman','FontSize',35,'fontweight','b')
ylabel('Amplitude (Volts)','Fontname','Times new roman','FontSize',35,'fontweight','b')
set(gca, 'FontName','Times New Roman','FontSize',35,'fontweight','b')
Hope i made myself clear about the problem, and expecting the good easy answer soon from you guys...
Thanx.....
0 comentarios
Respuestas (2)
Wayne King
el 24 de Abr. de 2013
Editada: Wayne King
el 24 de Abr. de 2013
If by "Then i modified/clipped/removed some signals in FFT spectrum figure file which are not required.", you mean that you removed 1/2 the frequency content
abs(out1(1:(length(out1)/2)+1))
Then you will have to add it back in order to get back to the original time domain signal. If you have only the "positive" frequencies you can fill out the DFT in order to invert the signal if you can assume the signal is real-valued.
For example,
Fs = 1000;
t = (0:1/Fs:1-1/Fs)';
x = cos(2*pi*100*t)+randn(size(t));
xdft = fft(x);
% signal is even length
xdft = xdft(1:length(x)/2+1);
Now I only have 1/2 the DFT, but if I know that x is real-valued
xdft = [xdft; conj(flipud(xdft(2:end-1)))];
xrec = ifft(xdft,'symmetric');
max(abs(x-xrec))
1 comentario
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!