Prev: SimBiology
Next: glmfit
From: Aaron on 4 Aug 2010 07:16 Hi, I am new to matlab and need a hand in using the FFT function in matlab. THE SITUATION I am shining an ultrasound field with frequency content from around 1MHz to around 230MHz at a film. The film thickness changes over time - this data I have. I need to decouple the frequency content from the thickness changes i.e. the impulse response. MY CODE ATTEMPT % calculate the relative displacement (i.e., the impulse response) rel_d = d2 - d1; %impulse response lngth = length(rel_d); %how many samples are taken %FFT the impulse response Fs = 1/4.05e-11; %sampling frequency X = fft(rel_d,lngth); %FFT Impulse response plot(X), xlabel('frequency / f s') THE RESULT The result of my code is nonsensical. It is a jagged, circular shape, when I'm expecting a nice clean frequency response. How can I improve upon my code to correctly FFT the impulse response?
From: Matt J on 4 Aug 2010 08:06 "Aaron " <ajerling(a)medphys.ucl.ac.uk> wrote in message <i3bi5k$j8r$1(a)fred.mathworks.com>... > The result of my code is nonsensical. It is a jagged, circular shape, when I'm expecting a nice clean frequency response. How can I improve upon my code to correctly FFT the impulse response? ================ How would we know? You've given no details about the original signal or any other information explaining your expectations. For all we know, you're mistaken about what the spectrum should look like. Best guess: a noisy spectrum can arise because the original signal has heavy tails (e.g. due to garbage background values). That's the Fourier dual of a noisy signal having a heavy-tailed spectrum.
From: Joseph on 4 Aug 2010 13:22 "Aaron " <ajerling(a)medphys.ucl.ac.uk> wrote in message <i3bi5k$j8r$1(a)fred.mathworks.com>... > Hi, > > I am new to matlab and need a hand in using the FFT function in matlab. > > THE SITUATION > > I am shining an ultrasound field with frequency content from around 1MHz to around 230MHz at a film. The film thickness changes over time - this data I have. I need to decouple the frequency content from the thickness changes i.e. the impulse response. > > MY CODE ATTEMPT > > % calculate the relative displacement (i.e., the impulse response) > rel_d = d2 - d1; %impulse response > lngth = length(rel_d); %how many samples are taken > > %FFT the impulse response > Fs = 1/4.05e-11; %sampling frequency > X = fft(rel_d,lngth); %FFT Impulse response > > plot(X), > xlabel('frequency / f s') > > THE RESULT > > The result of my code is nonsensical. It is a jagged, circular shape, when I'm expecting a nice clean frequency response. How can I improve upon my code to correctly FFT the impulse response? Aaron, The result of the FFT will be a complex number and you are plotting the result (X) in complex space. Try: plot(abs(X)); (if you want to view the absolute value - you can also use real, imag or angle...depending on what you want)
From: Aaron on 6 Aug 2010 07:47 Sorry for the late reply guys, I anticipated email alerts when the forum was updated. Joseph you are entirely correct, I was plotting the complex transform so I had to take the absolute part - which gave me nice clean lines. Thanks for your help. "Joseph " <don'twannapostit(a)nopers.com> wrote in message <i3c7js$edm$1(a)fred.mathworks.com>... > "Aaron " <ajerling(a)medphys.ucl.ac.uk> wrote in message <i3bi5k$j8r$1(a)fred.mathworks.com>... > > Hi, > > > > I am new to matlab and need a hand in using the FFT function in matlab. > > > > THE SITUATION > > > > I am shining an ultrasound field with frequency content from around 1MHz to around 230MHz at a film. The film thickness changes over time - this data I have. I need to decouple the frequency content from the thickness changes i.e. the impulse response. > > > > MY CODE ATTEMPT > > > > % calculate the relative displacement (i.e., the impulse response) > > rel_d = d2 - d1; %impulse response > > lngth = length(rel_d); %how many samples are taken > > > > %FFT the impulse response > > Fs = 1/4.05e-11; %sampling frequency > > X = fft(rel_d,lngth); %FFT Impulse response > > > > plot(X), > > xlabel('frequency / f s') > > > > THE RESULT > > > > The result of my code is nonsensical. It is a jagged, circular shape, when I'm expecting a nice clean frequency response. How can I improve upon my code to correctly FFT the impulse response? > > Aaron, > The result of the FFT will be a complex number and you are plotting the result (X) in complex space. > > Try: > plot(abs(X)); (if you want to view the absolute value - you can also use real, imag or angle...depending on what you want)
|
Pages: 1 Prev: SimBiology Next: glmfit |