Info
この質問は閉じられています。 編集または回答するには再度開いてください。
How to convert frequency spectrum to time domain waveform
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (2 件)
Wayne King
2013 年 4 月 24 日
編集済み: Wayne King
2013 年 4 月 24 日
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 件のコメント
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!