- #1
emirs
- 3
- 0
I am trying to write a solver for a 1D wave equation in MATLAB, and I have run into interesting problem that I just can't find a way out of.
I start with the wave equation, and then discretize it, to arrive at the following,
U{n+1}(j)=a*(U{n}(j+1)-2*U{n}(j)+U{n}(j-1))+2*U{n}(j)-U{n-1}(j) (for (j=1...end-1))
I'm trying to simulate an open end string (perturbate it in the middle for example, and I want the wave to disappear on the border)
Usually it is done (correct me if I'm wrong) with applying zero gradient boundary condition, which in my case is:
U{n}(end+1)=U{n}(end-1)
and leads to:
U{n+1}(end)=a*(-2*U{n}(end)+2*U{n}(end-1))+2*U{n}(end)-U{n-1}(end);
Unfortunately this condition creates a partial reflection from the end which is supposed to be free.
Please help
Regards
I start with the wave equation, and then discretize it, to arrive at the following,
U{n+1}(j)=a*(U{n}(j+1)-2*U{n}(j)+U{n}(j-1))+2*U{n}(j)-U{n-1}(j) (for (j=1...end-1))
I'm trying to simulate an open end string (perturbate it in the middle for example, and I want the wave to disappear on the border)
Usually it is done (correct me if I'm wrong) with applying zero gradient boundary condition, which in my case is:
U{n}(end+1)=U{n}(end-1)
and leads to:
U{n+1}(end)=a*(-2*U{n}(end)+2*U{n}(end-1))+2*U{n}(end)-U{n-1}(end);
Unfortunately this condition creates a partial reflection from the end which is supposed to be free.
Please help
Regards