Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote