if statement with and or
3 次查看(过去 30 天)
显示 更早的评论
Hi sorry, i want to create a code to know if a generic matrix A is positive definite. On my version of matlab (2016) when i write the second & the code gives me an error saying that "Matrix dimensions must agree". Can you help me?
A=[13/4 1/2 0; 1/2 17/4 1/2; 0 1/2 21/4]
[n,m]=size(A);
D_A=diag(A);
M_A=A-diag(D_A);
if n==m & A==A' & (abs(D_A)>sum(abs(M_A),2) | abs((D_A)')>sum(abs(M_A),1)) & diag(A)>0
disp 'A è DEFINITA POSITIVA'
end
12 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Performance and Memory 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!