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!