Mass spring damper system not working

조회 수: 9 (최근 30일)
Dirk te Brake
Dirk te Brake 2024년 5월 6일
댓글: Dirk te Brake 2024년 5월 7일
I'm solving an ode45 for a mass spring damper system as shown below. But the results i'm getting don't oscillate as much as they should. I have seen other questions about this (link) but can not get it to work. All help is apprecriated, thanks.
%% Initialisation
clc;
close all;
clear;
load("RealWorldData.mat")
m_total =[ 363.5 463.7 363.5 ; 563.9 663.1 563.9 ; 764.3 864.5 764.3]; % Different masses
m = m_total(2,:); % Masses used
t_end = 20; % Time in seconds
w = 5; % Staitionary frequency
k = 40; % Spring constant
b = 0.2; % Friction constant
%% Calculations
t = [0 t_end]; % Time period
x0 = [0, 0, 0, 0, 0, 0, 0]; % Initial conditions
Change = ischange(RealX);
index = find(Change,1,'first'); % Starting point realdata
index2 = find(Change,1,'last'); % Ending point realdata
RealX = RealX(index:index2,:)*0.001;
RealT = (1:length(RealX)).*0.001;
[Time,X] = ode45(@(t,x)MassSpringFunction(t,x,m,w,k,b),t,x0);
displacement = X(:,1:3);
velocity = X(:,4:6);
%% Plotting
figure
plot(Time,displacement)
hold on
plot(RealT,RealX)
legend("RealWorldData","U1" , "U2" , "U3")
%% System
function dxdt = MassSpringFunction(t, x, m, w, k, b)
% Acceleration of 10 hz/s
Freq = 2*pi*10*t;
if w > Freq % Acceleration of frequency
xin = sin(Freq.*t);
else % Stationairy input
xin = sin(2*pi*w.*t);
end
dxdt = zeros(6,1);
% Velocities
dxdt(1) = x(4);
dxdt(2) = x(5);
dxdt(3) = x(6);
% Positions
dxdt(4) = -k/m(1) .* (x(1) - xin) - k/m(1).*(x(1)-x(2)) - b/m(1).*x(4);
dxdt(5) = -k/m(2) .* (x(2) - x(1)) - k/m(2).*(x(2)-x(3)) - b/m(2).*x(5);
dxdt(6) = -k/m(3) .* (x(3) - x(2)) - k/m(3).*(x(3) ) - b/m(3).*x(6);
end
  댓글 수: 11
Sam Chak
Sam Chak 2024년 5월 7일
Based on the laws of physics, the derived model of the mass-spring-damper system with the external sinusoidal force, cannot accurately reproduce the response that matches the provided real-world measured unscaled data.
Firstly, there appears to be a delay in the real-world data, but this delay is not accounted for in the mathematical model. Secondly, when coupled mass systems are subjected to an external undamped sinusoidal input signal, they typically exhibit repetitive oscillatory patterns at specific periodic intervals. However, no such repetitive patterns are observed in the real-world data.
Hence, there might be some missing information. I recommend checking with your teacher for further clarification.
load("RealWorldData.mat")
plot(RealX), grid on, xlabel('Number of Samples'), ylabel('Amplitude'), title('Real-world data')
Dirk te Brake
Dirk te Brake 2024년 5월 7일
Hello @Sam Chak,
Thanks for the help! I will take a closer look at the mathematical model.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Assembly에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by