how can i change Matrix last row with loop?
2 次查看(过去 30 天)
显示 更早的评论
Hi there, i am a begginer in Matlab and i have problem with solving the matrix.. The problem is that i dont know how to change last row in matrix with numbers
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/414223/image.png)
[0 0 0 -1] - matrix one
[0 0 -2 -1] - matrix two
[0 -3 -2 -1] - matrix three
[-4 - 3 -2 -1] - matrix four
And here is my code:
for n = 2:5
A22 = eye(n, n-1);
A21 = zeros(n, 1);
A = [A21, A22];
end
(this code is working, i only need to change last row)
0 个评论
采纳的回答
Setsuna Yuuki.
2020-11-15
this can work
for n = 2:6
A22 = eye(n, n-1);
A21 = zeros(n, 1);
A = [A21, A22];
end
A = A(1:5,:)
5 个评论
Setsuna Yuuki.
2020-11-15
i don't know if the result is correct, but the eigenvalues can be complex.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!