Question: Provide scripts and graphs for each section Thanks % Use ODE45 to solve Example 4.4.3, page 205, Palm 3rd edition % Spring Mass Damper system

% Use ODE45 to solve Example 4.4.3, page 205, Palm 3rd edition
% Spring Mass Damper system with initial displacement
function SolveODEs()
clf %clear any existing plots
% Time range Initial Conditions
[t,y] = ode45( @deriv, [0,2], [1,0] );
% tvals yvals color and style
plot( t, y(:,1), 'blue');
title('Spring Mass Damper with initial displacement');
xlabel('Time - s');
ylabel('Position - ft');
pause % hit enter to go to the next plot
plot( t, y(:,2), 'blue--');
title('Spring Mass Damper with initial displacement');
xlabel('Time - s');
ylabel('Velocit - ft/s');
pause % hit enter to go to the next plot
plot( t, y(:,1), 'g', t, y(:,2), 'b--');
title('Spring Mass Damper with initial displacement');
xlabel('Time - s');
ylabel('Position and Velocity');
function XDOT = deriv( t, X)
% ind. var dep. var
%define model parameters
m=1; c=4; k=16;
%define the states as "nice" names
x=X(1); xdot=X(2);
%define any forcing functions
f=5*sin(2*t);
%write the non-trivial equations using the nice names
xddot= (1/m) * ( f -c*xdot - k*x );
XDOT = [xdot;xddot] ; %return the derivative value
5. Modify - SecondOrder ODE.m to do the following: a) Use the ode45() function to plot the solution for: x+++=4x6x8xft() where ft()=ut() (a unit step) over the range 0 to 10 seconds. All initial conditions are zero. Plot the position and velocity on separate graphs \% Use ODE45 to solve Example 4.4.3, page 205, Palm 3rd editio \% Spring Mass Damper system with initial displacement function SolveoDEs() clf \%clear any existing plots %[t,y]=ode45(ederiv,Edinge[,2],InitialConditions \% tvals yvals color and style plot(t,y(:,1), 'blue' ); title('Spring Mass Damper with initial displacement'); x label ('Time - s ); y label( Position. ft); pause \% hit enter to go to the next plot plot (t,y(:,2), 'blue-'); title('Spring Mass Damper with initial displacement'); x label ( 'Time - s ); ylabel('Velocit - ft/s ); pause % hit enter to go to the next plot \( p \operatorname{lot}\left(\mathrm{t}, \quad \mathrm{y}(:, 1), \quad ' g ', t, y(:, 2), \quad ' b-\mathrm{g}^{\prime} ight) \); title ('Spring Mass Damper with initial displacement'); x label ('Time - s ); ylabel( 'Position and velocity'); \%define model parameters m=1;c=4;k=16; \%define the states as "nice" names x=x(1);xdot=x(2); \%define any forcing functions f=5sin(2t); \%write the non-trivial equations using the nice names x ddot =(1/m)(fcxdotkx); XDOT=[xdot;xddot]; \%return the derivative value
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
