value assigned to variable might be unsured (Ln 12)
2 次查看(过去 30 天)
显示 更早的评论
m = 45; % mass in kg
k = 35000; % spring constant in N/m
c = 1200; % damping coefficient in N*s/m
F0 = 600; % amplitude of the force in N
omega = 40; % angular frequency of the force in rad/s
x0 = 0.0001; % initial displacement in m
v0 = 0.1; % initial velocity in m/s
t = linspace(0, 10, 1000); % time range from 0 to 10 seconds with 1000 data points
% Calculate the response function using the equation of motion:
omega_n = sqrt(k / m); % natural frequency
zeta = c / (2 * sqrt(m * k)); % damping ratio
omega_d = omega_n * sqrt(1 - zeta^2); % damped natural frequency
% Calculate the response function using the equation of motion:
omega_n = sqrt(k / m); % natural frequency
zeta = c / (2 * sqrt(m * k)); % damping ratio
omega_d = omega_n * sqrt(1 - zeta^2); % damped natural frequency
figure;
plot(t, X);
xlabel('Time (s)');
ylabel('Displacement (m)');
title('Response of Mass-Spring-Damper System');
grid on;
0 个评论
回答(1 个)
Shaik
2023-5-11
Hi Firas,
I hope this resolves your issue,
m = 45; % mass in kg
k = 35000; % spring constant in N/m
c = 1200; % damping coefficient in N*s/m
F0 = 600; % amplitude of the force in N
omega = 40; % angular frequency of the force in rad/s
x0 = 0.0001; % initial displacement in m
v0 = 0.1; % initial velocity in m/s
t = linspace(0, 10, 1000); % time range from 0 to 10 seconds with 1000 data points
% Calculate the response function using the equation of motion:
omega_n = sqrt(k / m); % natural frequency
zeta = c / (2 * sqrt(m * k)); % damping ratio
omega_d = omega_n * sqrt(1 - zeta^2); % damped natural frequency
X = (F0/m) ./ ((omega_n^2 - omega^2 + 2i*zeta*omega_n*omega) .* (omega_n^2 - omega^2 - 2i*zeta*omega_n*omega)); % displacement response
figure;
plot(t, real(X)*cos(omega_d*t) - imag(X)*sin(omega_d*t)); % plot the real part of X against time
xlabel('Time (s)');
ylabel('Displacement (m)');
title('Response of Mass-Spring-Damper System');
grid on;
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Assembly 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!