# How can I solve this matrix for y?

1 次查看（过去 30 天）
Keith Grey2020-6-15

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.

### 采纳的回答

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
##### 1 个评论显示隐藏 无
Keith Grey 2020-6-15
I'm following an example:
At the bottom of the page, Frquency vs Amplitude is achieved. That's what I'm trying to do.

### 类别

Find more on Assembly in Help Center and File Exchange

R2020a

### Community Treasure Hunt

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

Start Hunting!

Translated by