Question
Do it in MATLAB, Thanks function x = frsp_sdof(t) % Free response function of a SDOF system global m c k global x0 v0 wn
Do it in MATLAB, Thanks
function x = frsp_sdof(t) % Free response function of a SDOF system global m c k global x0 v0
wn = sqrt(k/m); % natural frequency ("omega_n") zeta = c/2/sqrt(k*m); % damping ratio wd = wn*sqrt(1-zeta^2); % damped natural frequency ("omega_d")
if zeta == 1; x = x0*exp(-wn*t) + (v0+wn*x0)*t.*exp(-wn*t); % critically damped case else x = exp(-zeta*wn*t).*(x0*cos(wd*t)+(v0+zeta*wn*x0)/wd*sin(wd*t)); end
function df = derivative(f) sym_f = sym(f); df = matlabFunction(simplify(diff(sym_f))); % simplify command is optional end
%% Script file project1.m %% Definition of system parameters: global m c k global x0 v0 m = 1e3; k = 81e3; % c x0 = 1; v0 = 0;
%% Part (a) % Plot the time response and total mechanical energy of the SDOF system % for the different cases of damping being considered. % Note: Project asks for only the cases of c = [3 18 25]*1e3 % c = 3e3 N.s/m % under-damped case (zeta = 0.167) % c = 18e3 N.s/m % critically damped case (zeta = 1) % c = 25e3 N.s/m % overdamped case (zeta = 1.389) c_values = [3 18 25]*1e3;
% Plot of the time response figure for j = 1:length(c_values) c = c_values(j); % plot the free response normalized with respect to x0 fplot(@(t) frsp_sdof(t)/x0, [0,2]), hold on end hold off
% Set plot parameters % set(gca,'FontSize',12) ax = gca; ax.YLim = [-0.8,1]; ax.XTick = (0:0.2:2); ax.YTick = (-0.8:0.2:1); ax.FontSize = 11; ax.LineWidth = 1; grid, xlabel('t [sec]'), ylabel('x/x_0 (normalized response)') title({'Time history of the free response of a suspension system', ... 'modeled by a single-degree-of-freedom system'}) LEG = legend('c = 3e3 N-s/m','c = 18e3 N-s/m','c = 25e3 N-s/m'); set(LEG, 'FontSize', 12)
% Plot of the mechanical energy versus time figure E0 = 0.5*k*x0^2 + 0.5*m*v0^2; % calculate the initial mechanical energy in [J] for j = 1:length(c_values) c = c_values(j); vel = derivative(@(t) frsp_sdof(t)); % define the velocity function % Define the energy function (E), which is the sum of the potential % and kinectic energies. Normalize E w.r.t. the initial energy E0. E=@(t) (0.5*k*frsp_sdof(t).^2 + 0.5*m*vel(t).^2)/E0; fplot(E, [0,2]), hold on end hold off
% Set plot parameters ax = gca; ax.YLim = [0,1]; ax.XTick = (0:0.2:2); ax.YTick = (0:0.1:1); ax.FontSize = 11; ax.LineWidth = 1; grid, xlabel('t [sec]'), ylabel('E/E_0 (normalized energy)') title({'Time history of the total mechanical energy', ... 'of a suspension system modeled by a SDOF system'}) LEG = legend('c = 3e3 N-s/m','c = 18e3 N-s/m','c = 25e3 N-s/m'); set(LEG, 'FontSize', 12)
2. Mathematical Modeling For the equivalent single-degree-of-freedom model, the restraining force due to the spring is = kx (Hooke's Law), and the restraining force due to the dashpot is Fa =-cx, where, k and c are the spring constant in N/m and the viscous damping coefficient in N-s/m, respectively, and dx are the time response and velocity of the suspension, respectively. Newton's and 2nd Law states that the algebraic sum of these forces acting on a body is equal to the time rate of change of its linear momentum (or simply mass times acceleration if mass is constant). Thus, we obtain the governing equation of motion for the displacement of the mass under free vibration mi + cx + kx -0, where x - dx(t)/dt where, the mass m is in kg. Equation (1) is a second-order linear ordinary differential equation with constant coefficients whose solution can be obtained either in exact form on numerically (see later chapter on numerical solution of ordinary differential equations). Time Figure 2. A typical result of the oscillation of the equivalent single-degree-of-freedom model as a result of an initial displacement x Introduce the following variables and teiologies: Onnatural frequency (rad/s); the frequency at which the undamped system vibrates ,-2 n where is called the damping ratio;--(a non-dimensional parameter) ,- Imt _ (2nm) 2-4m v 1-c2 , the damped natural frequency (rad/s) Imposing the initial conditions at t-0, x(0)-xo and (0)-Vo, the exact solution to Eqn. (1) can be expressed as sinaat), for # 1 Refer to materials from Differential Equations class for detailed derivations and mathematical background.] Note from Eqn. (2) and Fig. 2, the displacement dissipates and oscillates over time - with a frequency given by .--( and hence a period ofT,-2m/ --(2mL)> 0 or 1, respectively. Note that Eqn. (2) is not valid when the damping ratio is equal to 1 (critically damped case). For this case, the solution is given by Eqns. (2) and (3), when expressed in terms of the system parameters, are rather complex = e-ct/2rn Xocos m 2m We thus recommend using the solution forms represented in Eqns. (2) and (3) for evaluating the response of the SDOF suspension system and composing the MATLAB codes. These solutions are defined in frsp_sdof m-file. Note that the system parameters are defined in frsp_sdof as global variables. This technique might not work well with some versions of MATLAB, as the global command of variables conflicts with the fplot function. An alternative approach is to define the parameters as inputs to the function frsp_sdof 2. Mathematical Modeling For the equivalent single-degree-of-freedom model, the restraining force due to the spring is = kx (Hooke's Law), and the restraining force due to the dashpot is Fa =-cx, where, k and c are the spring constant in N/m and the viscous damping coefficient in N-s/m, respectively, and dx are the time response and velocity of the suspension, respectively. Newton's and 2nd Law states that the algebraic sum of these forces acting on a body is equal to the time rate of change of its linear momentum (or simply mass times acceleration if mass is constant). Thus, we obtain the governing equation of motion for the displacement of the mass under free vibration mi + cx + kx -0, where x - dx(t)/dt where, the mass m is in kg. Equation (1) is a second-order linear ordinary differential equation with constant coefficients whose solution can be obtained either in exact form on numerically (see later chapter on numerical solution of ordinary differential equations). Time Figure 2. A typical result of the oscillation of the equivalent single-degree-of-freedom model as a result of an initial displacement x Introduce the following variables and teiologies: Onnatural frequency (rad/s); the frequency at which the undamped system vibrates ,-2 n where is called the damping ratio;--(a non-dimensional parameter) ,- Imt _ (2nm) 2-4m v 1-c2 , the damped natural frequency (rad/s) Imposing the initial conditions at t-0, x(0)-xo and (0)-Vo, the exact solution to Eqn. (1) can be expressed as sinaat), for # 1 Refer to materials from Differential Equations class for detailed derivations and mathematical background.] Note from Eqn. (2) and Fig. 2, the displacement dissipates and oscillates over time - with a frequency given by .--( and hence a period ofT,-2m/ --(2mL)> 0 or 1, respectively. Note that Eqn. (2) is not valid when the damping ratio is equal to 1 (critically damped case). For this case, the solution is given by Eqns. (2) and (3), when expressed in terms of the system parameters, are rather complex = e-ct/2rn Xocos m 2m We thus recommend using the solution forms represented in Eqns. (2) and (3) for evaluating the response of the SDOF suspension system and composing the MATLAB codes. These solutions are defined in frsp_sdof m-file. Note that the system parameters are defined in frsp_sdof as global variables. This technique might not work well with some versions of MATLAB, as the global command of variables conflicts with the fplot function. An alternative approach is to define the parameters as inputs to the function frsp_sdofStep 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