How can I do inverse FFT? I have only frequency domain signal.

1 Ansicht (letzte 30 Tage)
HYUNWOONG KIM
HYUNWOONG KIM am 27 Jul. 2018
%data load
freq_range=[50 100 150 200 250 300 350 400 450 500 ...
550 600 650 700 750 800 850 900 950 1000 ...
1050 1100 1150 1200 1250 1300 ...
1350 1400 1450 1500 ...
]';
input_V=[0.044668359 0.044668359 0.044668359 0.044668359 ...
0.044668359 0.044668359 0.044668359 0.044668359 0.044668359 ...
0.044668359 0.044668359 0.044668359 0.044668359 0.044668359 ...
0.044668359 0.044668359 0.044668359 0.044668359 0.044668359 ...
0.044668359 0.044668359 0.044668359 0.044668359 0.044668359 ...
0.044668359 0.044668359 0.044668359 0.044668359 0.044668359 0.044668359 ...
];
%% time setting
dt = 800e-9;
% sampling frequency
fs = 1/dt;
%Input signal-frequency
input_freq = freq_range;
input_voltage = input_V;
figure(1)
stem(input_freq,input_voltage)
ylim([0 0.1])
xlabel('Frequency [MHz]')
ylabel('Amplitude')
title('Frequency Domain')
grid minor
% zeros pad
s = length(input_voltage);
n = 2^nextpow2(s);
%Input signal-Time
dim = 1;
initial=input_voltage(1);
last=input_voltage(end);
input_voltage=input_voltage(2:end-1);
input_voltage(2:end-1)=input_voltage(2:end-1)/2;
len=length(input_voltage);
for i=1:len
ifft_voltage(1,len-i+1)=input_voltage(1,i);
end
Y=[initial input_voltage last ifft_voltage initial]*abs(n);
y2=real(ifft(Y,n,dim))'; %denormalization
figure(100)
plot(y2);
title('time domain signal')
xlabel('time[ns]')
ylabel('|P1(t)|')
---------------------------------------------------------------------------------------------------------------------
I have only a frequency signal, and I want to convert it to a time domain signal. But I think this code is not working. Can you tell me why this code is wrong? And Can you tell me correct answer? Please, I need your help.
I want to get the exact result waveform of the IFFT of the input voltage.
  4 Kommentare
madhan ravi
madhan ravi am 27 Jul. 2018
Plot of y2 argument is time right?
HYUNWOONG KIM
HYUNWOONG KIM am 27 Jul. 2018
yes, I know. y2 plot is time domain signal, But it is not exactly IFFT result of input voltage signal. Do you think that y2 is correctly converted input voltage?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Naman Chaturvedi
Naman Chaturvedi am 2 Aug. 2018
I understand that the voltage signal you want to take IFFT of is a constant signal. If you just do
ifft(input_V);
you should get an impulse as the output. Which is fundamentally correct. But, if you want summation of different frequencies mentioned in 'freq_range' with different strengths mentioned in 'input_V', you have to perform zero padding according to the sampling period or sampling frequency.
To understand more about how the IFFT works, refer to the examples given in the link.

Community Treasure Hunt

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

Start Hunting!

Translated by