Jump to content

Wave interference model


Shadow

Recommended Posts

Hey all,

 

I've recently been attempting to use an animated 3D plot generated in Mathematica to model the interference of two waves. Since I couldn't think of a different way to do this, I used a parametric plot with the [math]x[/math] and [math]y[/math] coordinates equal to those on a circle:

 

[math]x = c \cdot \cos(t)[/math]

[math]y = c \cdot \sin(t)[/math]

 

As for the z coordinate, I make the z-coordinate in point [math]P[/math] of each wave separately equal to [math]\cos(|PS|)[/math], where [math]S[/math] is the source of the wave. This means that at every point P the z-coordinate of the resulting interference pattern should be equal to [math]\cos(|PS|) + \cos(|PS'|)[/math].

 

30lzz80.png

 

In the picture above, [math]c[/math] and [math]t[/math] are the parameters used in the parametric equations for [math]x[/math] and [math]y[/math]. Also, just for the sake of getting it working in a simplified version, I assume [math]S'_x = 0[/math] and I didn't realize that until after I finished making the picture. Sorry for the confusion.

 

This means that the z-coordinate should be equal to [math]\cos© + \cos(x)[/math] and using the law of cosine (I emphasize, [math]S'_x = 0[/math]),

 

[math]x = \sqrt{a^2 + c^2 - 2\cdot a \cdot c \cdot \cos(\frac{\pi}{2} - t)} = \sqrt{a^2 + c^2 + 2\cdot a \cdot c \cdot \sin(t)}[/math]

 

So, unless I am mistaken, the parametric equations for the interference pattern should be

 

 

[math]x = c \cdot \cos(t)[/math]

[math]y = c \cdot \sin(t)[/math]

[math]z = \cos© + \cos(\sqrt{a^2 + c^2 + 2\cdot a \cdot c \cdot \sin(t)})[/math].

 

Unfortunately, when I generate the corresponding plot, this is what I get:

 

2zowtw4.jpg

 

The second wave is much weaker that the one centered at [0; 0]. Why is that? Am I doing something wrong, or is it a fault of Mathematica's plotting routines? Here's the source I'm using to generate the plot:

 

length[a_, c_, t_] := Sqrt[a^2 + c^2 + 2*a*c*Sin[t]]
distance[x_, y_] := Sqrt[x^2 + y^2]
x = 9*Pi;
y = 0;

ParametricPlot3D[{c*Cos[t], c*Sin[t], 
 Cos[c] + Cos[length[distance[x, y], c, t]]}, {c, -60, 60}, {t, -60, 
 60}, Mesh -> None, PerformanceGoal -> "Quality", PlotPoints -> 160]

 

Thanks in advance for any help.

 

Also, even though it's one problem ahead of the one I have yet to solve, I attempted to make an animated plot of a wave centered at [0, 0] dispersing outward (like a rock falling into water). I would have though that the correct parametric equations for this would be

 

[math]x = c \cdot \cos(t)[/math]

[math]y = c \cdot \sin(t)[/math]

[math]z = \cos(c - a)[/math],

 

where a is the "animation parameter" (its value changes linearly as the animation progresses). Instead of getting what I was looking for, I get this strange thing where at first it's a plot of a normal wave, then as the animation goes on each maximum splits itself into half's, with one going towards the source of the wave and the other moving away from it. They then "collide" with half's from surrounding maximums, and form one larger one, over and over again. Here's a list of plot's to help illustrate things better, although I'm not sure it'll help that much (click for normal version):

 

nffomw_th.png

 

Any idea why this is happening, and what I have to do to get a normal wave propagating outward?

 

Thanks again.

 

EDIT: I think I'm starting to see why [math]\cos(x-a)[/math] won't work, but I still don't have a solution as to what will.

Edited by Shadow
Link to comment
Share on other sites

I'm really terrible with wave equations as seen here and I am having a really hard time analyzing your post. Your variables are, for me at least, not clearly defined and the details of certain steps are making it difficult for me to ascertain what you are doing. Like the very first step "I used a parametric plot with the x and y coordinates equal to those on a circle" has me a little lost.

 

Just starting at the basics

 

[math] z_{xy} = \cos \left ( radius \right ) [/math]

 

or

 

[math] z_{xy} = \cos \left ( \sqrt{x^{2} + y^{2}} \right ) [/math]

 

adding in a time oscillation of say

 

[math] \cos \left ( time \right ) [/math]

 

would yield

 

[math] z_{xy} = \cos \left ( \sqrt{x^2 + y^2} \right ) \cdot \cos \left ( t \right ) [/math]

 

and plotting this parametrically

 

[math] z_{xy} = \cos \left ( \sqrt{(\Delta x)^2 + (\Delta y)^2} \right ) \cdot \cos \left ( t \right ) [/math]

 

then superimpose :/

 

I hope I'm not imposing on your thread here .... I just don't see what is missing from your OP!

Edited by Xittenn
Link to comment
Share on other sites

Some guess:

 

_ make sure the wave at origin S' starts at time zero.

 

_If I understand correctly, "a is the "animation parameter" (its value changes linearly as the animation progresses)" is time. In fact in your 2nd question you got a plot of a regular wave as if it were inside a circular recipient. The wave comes naturally back to the center. I doubt the program will make the wave vanish to infinite, as you expected when waiting "to get a normal wave propagating outward"

Edited by michel123456
Link to comment
Share on other sites

Some guess:

 

_ make sure the wave at origin S' starts at time zero.

 

_If I understand correctly, "a is the "animation parameter" (its value changes linearly as the animation progresses)" is time. In fact in your 2nd question you got a plot of a regular wave as if it were inside a circular recipient. The wave comes naturally back to the center. I doubt the program will make the wave vanish to infinite, as you expected when waiting "to get a normal wave propagating outward"

 

a is not the distance between S[0;0] and S'[x;y] ?????? ??? ? ? ?? ? ?

 

[edit]

 

ahhhhh that a :/

 

is the animation parameter an attempt to add group velocity or, as michel suggested, decay?

 

If a equals the frame and say 1 frame = a phase shift of phase angle equal to pi/8 .....

 

[math] \nu = frequency [/math]

 

[math] w = angular \: frequency [/math]

 

[math] w = 2\pi\nu [/math]

 

[math] T = angular \: period [/math]

 

[math] T = \frac{1}{w} [/math]

 

[math] \phi(a) = \frac{T \cdot a}{16} [/math]

 

[math] \lambda = exponential \: decay \: rate [/math]

 

[math] r = radius [/math]

 

[math] \theta = e[- \lambda \cdot r ] [/math]

 

[math] f(x,y,a) = \cos \left ( \sqrt{ \left ( x \right )^2 + \left ( y \right )^2} + \phi(a) \right ) \cdot \theta [/math]

[math] g(x,y,a) = \cos \left ( \sqrt{ \left ( x - x_0 \right )^2 + \left ( y - y_0 \right )^2} + \phi(a) \right ) \cdot \theta [/math]

 

Animate[ Plot3D[ ( f(x,y,a) + g(x,y,a) )/2, ....

 

is ok?

Edited by Xittenn
Link to comment
Share on other sites

Xitten, #1: The wave I am trying to create will be a circular one, ie. no like what you get on the beach but what you get when you throw a stone in water. Thus, it's x and y coordinates must form a circle, and the parametric equation of a circle is

 

[math]x = r \cdot \cos(\phi), [/math]

[math]y = r \cdot \sin(\phi)[/math].

 

I can't explain why this is so in a proper and understandable way, other than what I said in the previous sentences, so you either have to arrive at the same conclusion using your own intuition or just accept it as a fact.

 

If I understood it correctly, your equation ([math] z_{xy} = \cos \left ( \sqrt{(\Delta x)^2 + (\Delta y)^2} \right ) \cdot \cos \left ( t \right ) [/math]) is the equation of a wave that stands still and oscillates in place (a standing wave). What I'm looking for is the equation for a wave that moves away from its source, like when you throw a rock into water, a travelling wave.

 

Michael: I'm not even attempting to animate the plot of two waves; for now I'm only trying to animate a single wave, with no success so far. Why does it behave like a wave in a circular container? Also, I don't need it to expand infinitely, just for as far as the plot is rendered.

 

Xitten, #2: I'm pretty sure what you posted is way more complicated then what I'm looking for. I don't want the wave to decay, I don't want it to start in any specific phase; I don't care about any of that. All I want it to do is make it move. I studied the final equations for a while, and came to the conclusion that they are exactly what I have; you have the square root in your equations, which is [math]c[/math] in my equations (since I'm basically using polar coordinates), to which you add a number dependent only on time (yes, a, or the "animation parameter" as I called it before, is time), which is what I tried doing with [math]\cos(c-a)[/math], and failed. And then you multiply all that with a decreasing function which guarantees the wave's amplitude will decrease with the distance from it's origin, which is irrelevant to me for the time being.

 

Just to clarify, this is what I'm trying to get (not the reflecting from the walls or the decreasing amplitude, just the movement outwards from the source):

Link to comment
Share on other sites

Shadow, unless I have made a mistake, which I often do, what I posted would produce a centripetal ripple in a pond and in #2 would emanate outward away from the source :/

 

Your solution is not entirely the same as it chain links the waves as opposed to modeling the events individually and super imposing the results. The way you are handling the model is rather complicated IMHO. I mean you pulled out the cosine law and everything :|

 

I don't have any software to do this so I would have to do it in C++ and render it with DirectX and this would take me some time as my engine is non functional and I would have to do it up from scratch or pieces.

 

Oh and your link is broke ....

 

I guess I can pass on Sushi today and give this a try ..... I was just about to bind to my first Meta Class ... :/

Edited by Xittenn
Link to comment
Share on other sites

I'm not sure what I did wrong yet .... it took me 12 hours to get a test bed going to start. I need to recalculate normals and figure out where my math went wrong :/ But I need some sleep ....

 

http://www.entangled-logik.com/Waves01.html

 

 

 

The original render is so much nicer ... it's kind of serene .. watching it render forever \o/

Edited by Xittenn
Link to comment
Share on other sites

Alright here is my ripple, outward travel no decay single wave event, using the equation I have given above

 

http://www.entangled-logik.com/waves02.html

 

and with two wave events

 

http://www.entangled-logik.com/waves03.html

 

which is what that will honestly look like unless a slew of other factors are incorporated to make it look like water ripply stuff ....

(I will try to upgrade this clip by recalculating normals)

 

that was fun ...

 

peace :)

Edited by Xittenn
Link to comment
Share on other sites

Okay, I figured both problems out. The "weakness" of the second wave still doesn't quite make sense (to be more exact, I know the cause, I just don't know why that would affect the plot the way it does), but I'm pretty sure it has more to do with the implementation of the rendering routines Mathematica uses than with something mathematical. It was caused by the fact that even though the parameter [math]t[/math] is an angle, I let it run from -60 to 60 when I render the plot (see the code snippet in the OP). When I change it to run from 0 to [math]2\pi[/math] (or 0 to [math]\pi[/math], which can be enough in certain circumstances, I'll explain in a bit) it works fine, and also takes a lot less time to render, which is great.

 

The "animation problem" was caused by something similar; the parameter [math]c[/math] plays the role of distance from the origin of the first wave; however, I also run it from -60 to 60. There were a couple of consequences that stemmed from the fact that I let [math]c[/math] be negative; one, for every point [math]P[/math] on the xy plane that was rendered, with polar coordinates [math][c, t][/math], where c is the distance from the origin and t the polar angle, the point [math]P'[-c, t][/math] or equivalently [math]P'[c, t + \pi][/math] was rendered (the equivalent points in Cartesian coordinates would be [math]P[x, y][/math], [math]P'[-x, -y][/math]). This is what allows me to only let [math]t[/math] run from 0 to [math]\pi[/math].

 

The second impact was the fact that while [math]\cos(x)[/math] is an even function (ie. [math]\cos(x) = \cos(-x)[/math], thus the fact that I let [math]c[/math] be negative had absolutely no impact), [math]\cos(x-a), a \in \mathbb{R}[/math] isn't. The easiest way to understand what happened is if we think of rendering the plot as taking the plot of [math]f(x) = \cos(x)[/math], placing it perpendicularly to the xy plane and rotating it around the z-axis. Once we start to animate the plot, we can think of it as animating the 2D plot of cosine and then rotating it around the z-axis. Since part of the plot is moving towards the origin and part is moving away, after rotating we get what looks like two waves traversing back and forth, even though it's actually (or can be though of as) a plot of two superimposed waves, one moving towards the center and one away from it.

 

The solution is to plot [math]\cos(|c|-a)[/math] or to restrict [math]c[/math] to [math]\mathbb{R}_0^+[/math], in which case we mustn't forget to change [math]t[/math] accordingly, otherwise we'll only get half a plot.

 

I'm not sure if this made much sense, it's a little difficult to explain using nothing but written word. But in any case, my problem is solved. Thanks for the effort everyone.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.