can any one solve this ?

17 次查看(过去 30 天)
KAREEM
KAREEM 2020-6-1
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.

回答(1 个)

Paresh yeole
Paresh yeole 2020-6-1
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 个评论
James Tursa
James Tursa 2020-6-1
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 2020-6-2
we are in coronaaaaaaaa

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by