Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
frequency vs. wave# plot; fft2 of E field

Subject: frequency vs. wave# plot; fft2 of E field

From: Woehrle

Date: 29 Jun, 2012 03:57:17

Message: 1 of 4

Greetings all,

I'm having some difficulty producing a frequency vs wavenumber plot from some E field data. (I'm trying to produce something comparable to this: http://i.imgur.com/0pGO2.png)

Anyways, I know what dt (time step) and dz (distance increment) for each E value.
So, an fft2 of Ey(z,t) should produce w,k? I might have this wrong...

Here is what I've been working on....


%load data file
load woctrlpts.dat

%Time & sample stuff
Nz = 44; %Number of samples collected along first dimension
Nt = 4097; %Number samples collected along second dimension
dz = .0017; %Distance increment
dt = 5.770885e-13; %time increment

%Nyqusit
Nyq_k = 1/(2*dz);
Nyq_f = 1/(2*dt);

dk = 1/(Nz*dz);
df = 1/(Nt*dt);

k = 0 : dk : Nyq_k - dk;
f = 0 : df : Nyq_f - df;
%Data array

E = woctrlpts(:,5);

%create E(z,t) matrix
space_time = reshape(E,44,[]);

%fft2 of space_time, might be right...
fft2result = fftshift(fft2(space_time))*dz*dt;

plot(k,f,abs(fft2result))

What are the necessary modifications I need to make to my code to produce a plot similar to the one mentioned above?

Thanks!

Subject: frequency vs. wave# plot; fft2 of E field

From: TideMan

Date: 30 Jun, 2012 03:56:47

Message: 2 of 4

On Friday, June 29, 2012 3:57:17 PM UTC+12, Woehrle wrote:
> Greetings all,
>
> I'm having some difficulty producing a frequency vs wavenumber plot from some E field data. (I'm trying to produce something comparable to this: http://i.imgur.com/0pGO2.png)
>
> Anyways, I know what dt (time step) and dz (distance increment) for each E value.
> So, an fft2 of Ey(z,t) should produce w,k? I might have this wrong...
>
> Here is what I've been working on....
>
>
> %load data file
> load woctrlpts.dat
>
> %Time & sample stuff
> Nz = 44; %Number of samples collected along first dimension
> Nt = 4097; %Number samples collected along second dimension
> dz = .0017; %Distance increment
> dt = 5.770885e-13; %time increment
>
> %Nyqusit
> Nyq_k = 1/(2*dz);
> Nyq_f = 1/(2*dt);
>
> dk = 1/(Nz*dz);
> df = 1/(Nt*dt);
>
> k = 0 : dk : Nyq_k - dk;
> f = 0 : df : Nyq_f - df;
> %Data array
>
> E = woctrlpts(:,5);
>
> %create E(z,t) matrix
> space_time = reshape(E,44,[]);
>
> %fft2 of space_time, might be right...
> fft2result = fftshift(fft2(space_time))*dz*dt;
>
> plot(k,f,abs(fft2result))
>
> What are the necessary modifications I need to make to my code to produce a plot similar to the one mentioned above?
>
> Thanks!

That's a contour plot.
Try:
contour(k,f,abs(fft2result))

Subject: frequency vs. wave# plot; fft2 of E field

From: Yash

Date: 30 Jun, 2012 12:48:09

Message: 3 of 4

i would say try a mesh plot or a surface plot for this will work best

makeyourassignment@yahoo.com

Subject: frequency vs. wave# plot; fft2 of E field

From: Woehrle

Date: 1 Jul, 2012 04:27:09

Message: 4 of 4

No luck so far. I'm not getting a useful graph. I might doing something wrong. I'll update tomorrow.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us