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:
Can you take a Fourier transforms over space

Subject: Can you take a Fourier transforms over space

From: Jeff

Date: 19 Aug, 2010 17:49:23

Message: 1 of 2

Hi. The following is for some research I am doing with a professor. I'm hoping to gain some insight before I return to him just as dumb as the last time I saw him (a rather tall order :D ).

I need to program a one-dimensional system of masses and non-linear springs. The masses all weigh the same and the springs all have the same (nonlinear) spring constant.

The professor said something to the effect that I did the Fourier transform wrong. He said I took the transform over time and that I need to take the transform over space (at least I think that's what he said).

The system to be solved is a second order differential equation for each mass. When broken into two first order differential equations, a system of four masses looks like this:

ydot_1=y_5;
ydot_2=y_6;
ydot_3=y_7;
ydot_4=y_8;
ydot_5=(0 - y_1)^3 + (y_2 - y_1)^3;
ydot_6=(y_1 - y_2)^3 + (y_3 - y_2)^3;
ydot_7=(y_2 - y_3)^3 + (y_4 - y_3)^3;
ydot_8=(y_3 - y_4)^3 + (0 - y_4)^3;

Note: the system is attached to walls, so think of it as y_0 = y_5 = 0

As a Matlab function:
function ydot = fpu3(t,y)
    %% Update mass position
    nMasses=4;
    ydot=zeros(nMasses*2,1);
    ydot=zeros(nMasses*2,1);
    ydot(1:nMasses)=y(nMasses+1:nMasses*2);
    
    left=1:nMasses-2;
    this=2:nMasses-1;
    right=3:nMasses;
    ydot(nMasses+1) = (0-y(1)).^3 + (y(2)-y(1)).^3;
    ydot(this+nMasses)= (y(left)-y(this)).^3 + (y(right)-y(this)).^3;
    ydot(end) = (y(nMasses-1)-y(nMasses)).^3 + (0-y(nMasses)).^3;
end

I set initial conditions, which was mode 1, and passed the system into ode45, like this:

% Set initial conditions
nMasses=4;
ii=(1:nMasses).';
s0=[sin(2*pi*ii/nMasses); zeros(nMasses,1)];

% Pass to ode45
[t,s1] = ode45(@fpu3, [0,1000], s0);
s1po=s1(:,1:end/2); % The POsition part of s1
s1fft=abs(fft(s1po));

That last step, apparently, is what's wrong.

Can anyone shed some light on Fourier transforms and how to take them over different variables? The ultimate goal is to plot a graph of the energy in each mode over time.

Thanks in advance for your help.

Subject: Can you take a Fourier transforms over space

From: TideMan

Date: 19 Aug, 2010 20:23:42

Message: 2 of 2

On Aug 20, 5:49 am, "Jeff " <spREMOVEHITSjef...@SIGNoptonline.net>
wrote:
> Hi. The following is for some research I am doing with a professor. I'm hoping to gain some insight before I return to him just as dumb as the last time I saw him (a rather tall order :D ).
>
> I need to program a one-dimensional system of masses and non-linear springs. The masses all weigh the same and the springs all have the same (nonlinear) spring constant.
>
> The professor said something to the effect that I did the Fourier transform wrong. He said I took the transform over time and that I need to take the transform over space (at least I think that's what he said).
>
> The system to be solved is a second order differential equation for each mass. When broken into two first order differential equations, a system of four masses looks like this:
>
> ydot_1=y_5;
> ydot_2=y_6;
> ydot_3=y_7;
> ydot_4=y_8;
> ydot_5=(0 - y_1)^3 + (y_2 - y_1)^3;
> ydot_6=(y_1 - y_2)^3 + (y_3 - y_2)^3;
> ydot_7=(y_2 - y_3)^3 + (y_4 - y_3)^3;
> ydot_8=(y_3 - y_4)^3 + (0 - y_4)^3;
>
> Note: the system is attached to walls, so think of it as y_0 = y_5 = 0
>
> As a Matlab function:
> function ydot = fpu3(t,y)
>     %% Update mass position
>     nMasses=4;
>     ydot=zeros(nMasses*2,1);
>     ydot=zeros(nMasses*2,1);
>     ydot(1:nMasses)=y(nMasses+1:nMasses*2);
>
>     left=1:nMasses-2;
>     this=2:nMasses-1;
>     right=3:nMasses;
>     ydot(nMasses+1)   = (0-y(1)).^3 + (y(2)-y(1)).^3;
>     ydot(this+nMasses)= (y(left)-y(this)).^3 + (y(right)-y(this)).^3;
>     ydot(end)         = (y(nMasses-1)-y(nMasses)).^3 + (0-y(nMasses)).^3;
> end
>
> I set initial conditions, which was mode 1, and passed the system into ode45, like this:
>
> % Set initial conditions
> nMasses=4;
> ii=(1:nMasses).';
> s0=[sin(2*pi*ii/nMasses); zeros(nMasses,1)];
>
> % Pass to ode45
> [t,s1] = ode45(@fpu3, [0,1000], s0);
> s1po=s1(:,1:end/2);     % The POsition part of s1
> s1fft=abs(fft(s1po));
>
> That last step, apparently, is what's wrong.
>
> Can anyone shed some light on Fourier transforms and how to take them over different variables? The ultimate goal is to plot a graph of the energy in each mode over time.
>
> Thanks in advance for your help.

I know nothing about springs and masses, but in turbulent water flow,
we convert from time to space and vice versa using "Taylor's
hypothesis of frozen turbulence" which says that you can transform
from one to the other by using the freestream (mean) velocity. There
may be some analogous transformation "velocity" (i.e. a natural Length/
Time scaling) for your problem.

Tags for this Thread

No tags are associated with 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