clc;
clear all;
close all;
m =1; c=0.5;k=1; mu = [0.001,0.1,1,0];
F1 = @(t) heaviside(t); F2 = @(t) t*heaviside(t);
% let x = X1; x' = X2;
syms x(t)
for i = 1:numel(mu)
%assumed init conditions x' = 0, x = 0
x0 = 0; xp0 = 0;
fprintf(['\n assumed initial coditions x'' = ' num2str(xp0) ', x =
' num2str(x0)])
%assumed integration time range [0 30]
a = 0; b = 30;
fprintf(['\n assumed time (integration) range a = ' num2str(a) ', b
= ' num2str(b)])
fprintf(['\n mu = ' num2str(mu(i))])
[V1] = odeToVectorField(m*diff(x,2)+ c*diff(x)+k*x + mu(i)*x^3 ==
F1(t))
[V2] = odeToVectorField(m*diff(x,2)+ c*diff(x)+k*x + mu(i)*x^3 ==
F2(t))
M1 = matlabFunction(V1,'vars',{'t','Y'})
M2 = matlabFunction(V2,'vars',{'t','Y'})
solutionF1 = ode45(M1,[a b],[x0 xp0]) ;
solutionF2 = ode45(M2,[a b],[x0 xp0]) ;
figure(1)
fplot(@(x) deval(solutionF1,x,1),[a b])
hold on
grid on
xlabel('t')
ylabel('x(t)')
title(['mx'''' + cx'' + kx + mux^3 = u(t)'])
legend1Info{i} = strcat('mu = ',num2str(mu(i)));
figure(2)
fplot(@(x) deval(solutionF2,x,1),[a b])
hold on
grid on
xlabel('t')
ylabel('x(t)')
title(['mx'''' + cx'' + kx + mux^3 = t u(t)'])
legend2Info{i} = strcat('mu = ',num2str(mu(i)));
end
figure(1),legend(legend1Info);
figure(2),legend(legend2Info);
Use Matlab and provide the code Consider the equation for the forced oscillation of a damped...
A damped forced oscillation with mass-spring sys- tem is modeled as an nonhomogeneous ODE as following: my" + cy' + ky = r(t) where m = 1 kg, k = 1 N/m and c = 2 N m/s. Initially, y(0) 1m y(0) = -1m/s. r(t) is the input force for this system. Initially (t = (s), there is no input force for this system r(t) = 0 N. At time t = 2s, a costant force (r(t) = 2 N)...
Please provide the matlab code solution for this problem. Exercise 2 Consider the differential equation for the Van der Pol oscillator (use ode45) which has a nonlinear damping term a (y -1) y 1. For E 0.25, solve the equation over the interval 0,50 for initial conditions y (0) 0.1 and y' (0) -1. TASK: Save y as a column vector in the file A04.dat TASK: Save y' as a column vector in the file A05.dat 2. For a 10,...
Implement the 4th order Runge-Kutta algotithm in MATLAB. Use the script you produced to integrate the following function x(t)--10t + e-t , x(0)--1; t.-0 t, = 1 Vary At and observe the difference in your results. Let At 0.2 sec., 0.1 sec., 0.05 sec. and 0.01 sec. Now integrate the function analytically and compare your result with the results obtained numerically Implement the 4th order Runge-Kutta algotithm in MATLAB. Use the script you produced to integrate the following function x(t)--10t...
I want matlab code. 585 i1 FIGURE P22.15 22.15 The motion of a damped spring-mass system (Fig. P22.15) is described by the following ordinary differ- ential equation: dx dx in dt2 dt where x displacement from equilibrium position (m), t time (s), m 20-kg mass, and c the damping coefficient (N s/m). The damping coefficient c takes on three values of 5 (underdamped), 40 (critically damped), and 200 (over- damped). The spring constant k-20 N/m. The initial ve- locity is...
SOLVE USING MATLAB PLEASE THANKS! The governing differential equation for the deflection of a cantilever beam subjected to a point load at its free end (Fig. 1) is given by: 2 dx2 where E is elastic modulus, Izz is beam moment of inertia, y 1s beam deflection, P is the point load, and x is the distance along the beam measured from the free end. The boundary conditions are the deflection y(L) is zero and the slope (dy/dx) at x-L...
Please provide the used MATLAB code. 2. Consider the closed-loop transfer function: T(s) a) Obtain the family of impulse responses for K-10, 200 and 500 b) Obtain the family of step responses for K-10, 200 and 500. c Obtain the family of ramp responses for K-10, 200 and 500. b) Co-plot each of the family of responses Explain using the DC-Gain for each of the K and the test signal. Is there any difference between s2+5s+K K's in terms of...
If you can provide the MatLab code too, thank you! 3. The equation of motion of a general mass-spring system subject to an external force F(t) is mr" + cr' + kr = F(t) where m, c and k are the mass, damping coefficient and spring constant respectively. Let's consider a simple undamped system where m = 1, k = 1, and c= 0 and with forcing function F(t) = 0.5 cos(t) (all in SI units) "+=0.5 cos(1) Find the...
Problem Thre: 125 points) Consider the following initial value problem: dy-2y+ t The y(0) -1 ea dt ical solution of the differential equation is: y(O)(2-2t+3e-2+1)y fr exoc the differential equation numerically over the interval 0 s i s 2.0 and a step size h At 0.5.A Apply the following Runge-Kutta methods for each of the step. (show your calculations) i. [0.0 0.5: Euler method ii. [0.5 1.0]: Heun method. ii. [1.0 1.5): Midpoint method. iv. [1.5 2.0): 4h RK method...
MATLAB question. Please answer all the questions and also upload the code by MATLAB. Thanks. Down vote if no code provided. For the circuit shown above, at the moment t = 0, the switch is closed, find w(t) for 120, No energy is stored in the capacitor and inductor at moment t-0 1. Write the dynamic model for RLC circuit after t> 0? a. Show all vour work and calculations b. Write down the characteristic equation of the transfer function...
USING MATLAB Please post code 1. Solve the 2nd order differential equation ?+89 +15y-sin(t), y(0)-1,?(0)-2 symbolically and numerically, and plot both results together over the time interval 0,10 sec. Provide appropriate labels on both axes, a title, and a legend that denotes each solution. Check your symbolic answer by using the Matlab DIFF function to compute the appropriate derivatives and then substituting them into the differential equation.