Solving wave equation using matlab?
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen

Using the analytical solution(attached), compute the solution for grid spacings of dx/L = (2^-5, 2^-7, 2^-9).(i.e. 33, 129 and 513 points). Choose your time-step such that the stability criteria is met for each grid spacing. Run your numerical solution for 2 cycles (t = 2T, where T is the period for one wave cycle of the 5th mode) and present a plot of the displacement at times, t = 0.5T; 1T; 1.5T; 2T. Each plot should compare the three grid spacings to the analytical solution. Comment on the accuracy of your numerical stencil. When presenting your results you should use at least n = 1000 points for your analytical solution so that the curve appears continuous.
c = 340 L = 0.09
I have attached my code to solve this question, it seems to give 4 graphs which all look the same? According to the qn, they should be different. Please clarify where the mistake is thanks!
0 Kommentare
Antworten (1)
Ameer Hamza
am 29 Apr. 2018
You are getting this problem because of 4 plot statements at the end of your code are plotting same curves
plot(x,gnp1);
all 4 plot use same x and gnp1. You need to save each result individually in an array and plot. Alternatively, you can move plot inside for loop and plot the result of each iteration.
0 Kommentare
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!