Below is my code for forward Euler. Can you help me figure out what the MatLab c
ID: 3402011 • Letter: B
Question
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....
Explanation / Answer
M=[A B;D E];b=[-c;-f]
for i=1:100
M=inv(x)*b;
b=M;
end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.