Search code examples
pythonmatlabmaplewave

How to fix these two angled boundaries in Maple


I have this animation done on Maple. I want the two sides which meet at a point to be fixed. The same way the other two straight sides are. Is it possible in Maple, and if not, is it possible to do it in MatLab and how?

with(plots):
animate(plot3d,[sin(Pi*(t-x))*sin(Pi*y)*Heaviside(t-x)-sin(Pi*(t+x))*sin(Pi*y)*Heaviside(t+x),x=0..4,y=piecewise(x>=0 and x<2,1/2-x/4,0)..piecewise(x>=0 and x<2,1/2+x/4,1)],t=-2*Pi..2*Pi, frames=90);

Thanks a lot.

Image on what it look like at t=0 in Maple


Solution

  • The original,

    with(plots):
    
    animate(plot3d,
        [sin(Pi*(t-x))*sin(Pi*y)*Heaviside(t-x)
         -sin(Pi*(t+x))*sin(Pi*y)*Heaviside(t+x),
         x=0..4,
         y=piecewise(x>=0 and x<2,1/2-x/4,0)
           ..piecewise(x>=0 and x<2,1/2+x/4,1)],
        t=-2*Pi..2*Pi, frames=90);
    

    enter image description here

    Is this what you're after?

    with(plots):
    
    adjustor:=sin(Pi*piecewise(x>=0 and x<2,(y-1/2)/(x/2)+1/2,y)):
    
    animate(plot3d,
            [sin(Pi*(t-x))*adjustor*Heaviside(t-x)
             -sin(Pi*(t+x))*adjustor*Heaviside(t+x),
             x=0..4,
             y=piecewise(x>=0 and x<2,1/2-x/4,0)
               ..piecewise(x>=0 and x<2,1/2+x/4,1)],
             t=-2*Pi..2*Pi, frames=45);
    

    enter image description here