Pre-Engineering 220 Introduction to MatLab ® & Scientific Programming j kiefer



Download 8.69 Mb.
Page122/128
Date02.05.2018
Size8.69 Mb.
#47255
1   ...   118   119   120   121   122   123   124   125   ...   128
b. Solution

Any method, such as Euler’s, may now be applied to each first order equation in turn. Thusly:







.

The MatLab® code might look like this:

z(1) = 0.0

z(2) = xo

z(3) = vo

h = 0.01


for i=1:100

z(1) = z(1) + h

z(2) = z(2) +h*z(3)

z(3) = z(3) + h*f(z(1),z(2),z(3))



end
c. Example




Download 8.69 Mb.

Share with your friends:
1   ...   118   119   120   121   122   123   124   125   ...   128




The database is protected by copyright ©ininet.org 2024
send message

    Main page