Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help with calculation of IFFT in Matlab

Status
Not open for further replies.

rohitmalpani

Newbie level 1
Joined
Aug 18, 2005
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,289
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,
 

echo47

Advanced Member level 5
Joined
Apr 7, 2002
Messages
3,942
Helped
638
Reputation
1,274
Reaction score
89
Trophy points
1,328
Location
USA
Activity points
33,176
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]');
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top