value assigned to variable might be unsured (Ln 12)
조회 수: 6 (최근 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!
