SuperpositionWavesApp extends AbstractSimulation and doStep()

Adam S.
2 Posts

Hi, I am trying to write a code for superposition of waves in textbook tobochnik,gould exercise 4.4. using the SuperpositionWavesApp extends AbstractSimulation and doStep() because question states to use this method.

the doStep method draws a function when code within {} is completed. public void doStep() { plotFrame.append(0, wave.state[1], wave.state[0]); wave.step(); } I have no problem plotting a sine wave in the graph y vs x using this method for x values however, I have to plot it moving in time. When I try for loop using dt step it will not work. It just plots the final results. How do I frame the doStep method so that it will shift/move the sine wave by dt?