Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Driving me nuts!
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Robert Jordan

Posts: 6
Registered: 12/7/04
Driving me nuts!
Posted: Sep 21, 1996 3:33 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Reposting article removed by rogue canceller.

Here's a question that has probably been asked before:

I'm trying to view a time-domain plot of some frequency domain data I
have (From an HP network analyzer). All I need to do is figure out how
to derive the time axis. Here's the code


--------------------------
points = 4096;
frequency = input('Frequency (MHz)? ');
frequency = frequency * 1e6;
lowfreq = 200E6;
highfreq = 400E6;

BW = highfreq-lowfreq;
FreqStep = BW./(points-1);

%create the frequency axis
f = [lowfreq:FreqStep:highfreq];

%create the time axis
TimeStep = 1./(2*BW);
t = [0:TimeStep:TimeStep.*(points-1)];


%Set up an impulse signal at the desired frequency
%Figure out the center bin for the selected frequency
deltafreq = frequency-lowfreq;
deltapoints = deltafreq/FreqStep; %frequency better be within BW
deltapoints = round(deltapoints); %Has to be an integer

%create a signal within the band with impulse at deltapoints
yf = [zeros(1,deltapoints-1) ones(1,1) zeros(1,points-deltapoints)];

%plot the signal
figure(1)
plot(f,yf);
fftaxis = axis;
xlabel('freq (Hz)');
ylabel('amplitude');
title('Freq domain');

%create the fft
y = ifft(yf);

%plot the time domain
figure(2)
plot(t,real(y));
V = axis;
%axis([0 max(t) V(3) V(4)]);
xlabel('Time (s)');
ylabel('');
title('Time domain');

%create the fft
yf1 = fft(y);

%plot the ifft
figure(3)
plot(f,yf1);
axis(fftaxis);
xlabel('Freq');
ylabel('amplitude');
title('Reconstructed freq domain');

-----------------------------------
What happens is that the freq domain and the reconstructed freq domain
are perfect. The only problem is the scaling of the time domain axis.
As far as I know, the time resolution is simply

1/(2*bandwidth)

and the entire time axis is

(1/(2*bandwidth) * numpoints)

But that doesn't seem to work. Does anyone have the real story on
obtaining the proper time resolution and time span for a bandwidth
limited discrete frequency domain data set? It's been driving me nuts!

Robert





--
-----------------------------------------------------------
An EE guy who just lives and breaths off road motorcycles.
-----------------------------------------------------------





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.