can any one solve this ?

A small scale model of a passenger car can be represented by the simple mass supported by a spring and a damper as shown in Fig. Q2. The vertical motion of this system can be described by the following ordinary differential equation: 𝒎𝒅𝟐𝒙𝒅𝒕𝟐+𝒄𝒅𝒙𝒅𝒕+𝒌𝒙=𝟎
where x = displacement from equilibrium position (m), t = time (s), m =mass (kg) and c = the damping coefficient (N · s/m) and k = spring constant (N/m). The mass is 20 kg. The spring constant k = 20 N/m. The initial velocity (dx/dt) is zero, and the initial displacement x = 0.5 m.
The damping coefficient c takes on three values of 5 (underdamped), 40 (critically damped), and 200 (overdamped).
A- Write and execute a computer code using ‘Octave platform’ to solve this equation over the time period 0 ≤ t ≤ 5 s for the underdamped and overdamped cases.
B- Plot the displacement (x) and velocity (dx/dt) versus time for the under damped and overdamped cases for the whole time period.
C- Compare the results using different time steps for the underdamped case only.

Réponses (1)

Paresh yeole
Paresh yeole le 1 Juin 2020

1 vote

m = 20; % kg
k = 20; %N/m
x_0 = 0.5; %m
c1 = 5; %underdamped
c2 = 40; % critically damped
c3 = 200; %overdamped
syms x(t)
Dx = diff(x,t);
Dx2 = diff(x,t,2);
ode = m*Dx2+c1*Dx+k*x == 0;
ode1 = m*Dx2+c3*Dx+k*x == 0
cond1 = x(0) ==0.5;
cond2 = Dx(0) == 0;
conds = [cond1 cond2];
xSol(t) = dsolve(ode,conds);
xSol1(t) = dsolve(ode1,conds);
for t=1:5
dist(t) = eval(xSol(t));
dist1(t) = eval(xSol1(t));
end
The above code will help you complete the second and third question

4 commentaires

Kento
Kento le 1 Juin 2020
can you please write the code for the graph ? like "plot x,y"
John D'Errico
John D'Errico le 1 Juin 2020
Please don't do homework assignments for people. This teaches them nothing, except that they can find someone to do their work for them.
James Tursa
James Tursa le 1 Juin 2020
Maybe the OP couldn't find anyone to do the homework for him on the Octave forum, so he came here ...
Kirollos hany
Kirollos hany le 2 Juin 2020
we are in coronaaaaaaaa

Connectez-vous pour commenter.

Catégories

En savoir plus sur Numerical Integration and Differential Equations dans Centre d'aide et File Exchange

Question posée :

le 1 Juin 2020

Commenté :

le 2 Juin 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by