How can I solve this matrix for y?
2 ビュー (過去 30 日間)
古いコメントを表示
M = [1 0 0 0; 0 1 0 0; 0 0 20 0; 0 0 0 10]; % Mass matrix
y = [x1; x2; v1; v2]; % Displacement & Velocity Matrix
B = [0 0 -1 0; 0 0 0 -1; -2 2 -2 2; 1 -1 1 -1]; % Spring Matrix
C = [0; 0; 0; -1]; % Force Matrix
I'm following an example:
At the bottom of the page, Frequency vs Amplitude is achieved. That's what I'm trying to do.
0 件のコメント
採用された回答
Ameer Hamza
2020 年 6 月 15 日
See ode45()
tspan = [0; 10];
IC = [1 1 0 0]; % initial condition
[t, Y] = ode45(@odeFun, tspan, IC);
plot(t, Y);
legend({'x_1', 'x_2', 'v_1', 'v_2'});
function dYdt = odeFun(t, Y)
M = [1 0 0 0; 0 1 0 0; 0 0 20 0; 0 0 0 10]; % Mass matrix
B = [0 0 -1 0; 0 0 0 -1; -2 2 -2 2; 1 -1 1 -1]; % Spring Matrix
C = [0; 0; 0; -1]; % Force Matrix
dYdt = M\(C - B*Y);
end
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!