Question: syms x ( t ) ; M = 2 2 ; C = 5 3 ; K = 6 7 8 9 ; x 0

syms x(t);
M =22;
C =53;
K =6789;
x0=0.007;
v0=0.03;
ode = diff(x, t,2)+(C/M)*diff(x, t)+(K/M)*x ==0;
Dx = diff(x, t);
cond1= x(0)== x0;
cond2= Dx(0)== v0;
xSol = dsolve(ode, cond1, cond2);
xSol_func = matlabFunction(xSol);
time = linspace(0,10,1000);
displacement = xSol_func(time);
figure;
plot(time, displacement);
title('System Response Due to Initial Conditions');
xlabel('Time (s)');
ylabel('Displacement (m)');
grid on;
Please tell me if this code is coorect to run. I have hard time running it.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!