Matrix dimensions must agree error
显示 更早的评论
I keep getting a 'Matrix demensions must agree error' but I don't know why
h = 0.01;
start = 0;
stop = 7;
x = start:h:stop;
w = zeros(size(x));
M = eye(numel(x)-2) .* cos(x);
K = eye(numel(x)-2) .* -2;
v = ones(1, numel(x)-3);
K1 = diag(v, -1);
K2 = diag(v, 1);
K = K + K1 + K2;
K = K .* (1./(h.*h));
A = K + M;
f = ones(1, numel(x));
f = f .* sin(x);
w = A \ f;
plot(x, w);
grid on;
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Operating on Diagonal Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!