Below is my code for forward Euler Can you help me figure ou
Below is my code for forward Euler. Can you help me figure out what the MatLab code is using the BACKWARD EULER method?
-----------------------------------------------------------------------------------------------------------------
% Forward Euler Calculation for M1 and M2
for n = 1:100
M1(n+1) = M1(n) + k*((F01+C21*M2(n))-(C10*M1(n)+C12*M1(n))); %mass one
M2(n+1) = M2(n) + k*(C12*M1(n) - C21*M2(n)); %mass two
end
----------------------------------------------------------------------------------------------------------------
I think you need to solve a system of equations using linear algebra....
Solution
M=[A B;D E];b=[-c;-f]
for i=1:100
M=inv(x)*b;
b=M;
end
