electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

Help with calculation of IFFT in Matlab


Post new topic  Reply to topic    EDAboard.com Forum Index -> Digital Signal Processing -> Help with calculation of IFFT in Matlab
Author Message
rohitmalpani



Joined: 18 Aug 2005
Posts: 1


Post25 Jun 2007 21:58   

matlab ifft


Hii,
I'm generating a text file in Labview which contains the real and imaginary parts of intensity of a signal and I wish to calculate it's IFFT and come in time domain.
I have 201 points in the frequency range of 0Ghtz to 10Ghtz.
I need to first create a complex conjucate signal in range of -10Ghtz to 10Ghtz, so that when I do IFFT I get a real signal in time domain.
But I'm stuck with the former problem itself and not able to create a complex conjucate signal from my original signal in positive frequency.
Can anyone help around,
Back to top
Google
AdSense
Google Adsense




Post25 Jun 2007 21:58   

Ads




Back to top
echo47



Joined: 07 Apr 2002
Posts: 4206
Helped: 566


Post26 Jun 2007 5:36   

ifft matlab


Try this -- copy and paste it into your MATLAB Command Window.

The middle section does the ifft. The other sections simply create some input data, and plot the results. You may want to modify the tweaks at DC and Nyquist, depending on how your measurement hardware behaves at those points.

Code:
% Generate input data: square wave built from the first few frequency/phase harmonics
fmax = 10;              % maximum frequency, GHz
Nf = 201;               % frequency points, from zero to fmax
data = zeros(1,Nf);
data(1) = 1;            % square wave DC offset
cycles = 4;             % square wave cycles
phase = 2.1;            % square wave phase shift, radians
for k = 1:2:15          % sum several harmonics
  data(1 + k * cycles) = 1.27 / k * exp(1j * ((k-1)/2 * pi + k * phase));
end
freq = 0:fmax/(Nf-1):fmax;
subplot(3,1,1); plot(freq, abs(data)); xlabel('Input Spectrum [GHz]');

% Calculate ifft of half-spectrum data
h = [conj(data) fliplr(data(2:length(data)-1))];
h(1) = 2 * real(h(1));                          % DC tweak
h(length(data)) = 2 * real(h(length(data)));    % Nyquist tweak
y = ifft(h);

% Plot results
N = length(h);
freq = 2 * fmax * (-N/2 : N/2-1) / N;
time = (0 : N-1) / 2 / fmax;
subplot(3,1,2); plot(freq, abs(fftshift(h))); xlabel('Expanded Spectrum [GHz]');
subplot(3,1,3); plot(time, N / 2 * y); xlabel('Time-Domain [nanoseconds]');
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> Digital Signal Processing -> Help with calculation of IFFT in Matlab
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
pll loop parameters calculation with matlab? (5)
How can I use the IFFT in Matlab?? (4)
PSD calculation using Matlab{help needed} (1)
Problems with fft and ifft (1)
Help with Calculation of T and R Spectra using Fullwave (1)
for help about IFFT! (10)
help me with antenna with radome in matlab (4)
crc calculation in matlab (2)
Matlab: Integral Calculation Issues (1)
MATLAB code for SAR calculation (1)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS