MATLAB: How to generate waveform graph

waveform

Can anyone help me generate code to produce this waveform graph? This is wave equation that using finite difference method. Thank you very much for helping..

Best Answer

Here is a simple script that will plot the function sin(L*x). Perhaps you can adapt it to plot your function u(x,t):
L = 0.5;
x = 0 : 0.1 : 60;
u = sin(L*x);
figure
plot(x,u)