Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I have a working matlab code - % Parameters M = 1 ; K = 3 ; B = 0 . 5 ; x 0
I have a working matlab code Parameters
M ;
K ;
B ;
x;
v;
t;
tend ;
h ;
Function for Euler equation solution
f @t x x x;
f @t x xBM xKM x;
Euler method
tneuler t:h:tend;
xeuler zerossizetneuler;
xeuler zerossizetneuler;
xeuler x;
xeuler v;
fprintfAll Euler steps
;
for i :lengthtneuler
t tneuleri;
x xeuleri;
x xeuleri;
xeuleri x h ft x x;
xeuleri x h ft x x;
fprintff f f
tneuleri xeuleri xeuleri;
end
Plotting numerical solution using Euler method
figure;
hold on;
plottneuler, xeuler, 'linewidth', ;
plottneuler, xeuler, 'linewidth', ;
plottneuler, xeuler xeuler, 'linewidth', ;
legendDisplacement 'Velocity', 'Acceleration';
titleSolution using Euler method';
box on;
RungeKutta method
xrk zerossizetneuler;
xrk zerossizetneuler;
xrk x;
xrk v;
fprintfAll Runge Kutta steps
;
for i :lengthtneuler
t tneuleri;
x xrki;
x xrki;
k h ft x x;
l h ft x x;
k h ft h x k x l;
l h ft h x k x l;
k h ft h x k x l;
l h ft h x k x l;
k h ft h x k x l;
l h ft h x k x l;
xrki xkkk k;
xrki xlll l;
fprintff f f
tneuleri xrki xrki;
end
Plotting numerical solution using RungeKutta method
figure;
hold on;
ylim;
plottneuler, xrk 'linewidth', ;
plottneuler, xrk 'linewidth', ;
plottneuler, xrk xrk 'linewidth', ;
legendDisplacement 'Velocity', 'Acceleration';
titleSolution using RungeKutta method';
box on; And I need to implement this to it Turn off the sliding friction and set h but keep all other parameters the same.
Integrate using the Euler Method. You will see that the oscillator is now unstable.
As one shrinks h the oscillations become more convergent to steady state, however,
ideal behavior yt yt T where T is the period of the oscillation requires
infinite numerical precision.
Show what the behavior looks like with the IEM and the RK method for h
DLV x
Find the limit of h for the Euler Method EM such that the oscillations increase by
less than over a period of oscillation, ie yt T ytDLV
For part II you may have to change the IntegrationTime to examine the stability.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started