I am working with a piece of Matlab where I have:
n = 4;
Mbar = zeros(n,n);
Mbar(1,1) = M;
Mbar(2,2) = Ixx;
Mbar(3,3) = Iyy;
Mbar(4,4) = Izz;
L = zeros(n,n);
L = chol(Mbar)';
An error message said that it didn't like M, Ixx, Iyy, and Izz. So I changed the code to:
syms M Ixx Iyy Izz;
assume(M>0);
assume(Ixx>0);
assume(Iyy>0);
assume(Izz>0);
M = vpa(Mbar(1,1));
Ixx = vpa(Mbar(2,2));
Iyy = vpa(Mbar(3,3));
Izz = vpa(Mbar(4,4));
L = zeros(n,n);
L = chol(Mbar)';
An error message was returned stating that Mbar must be positive definite for the Cholesky decomposition to be performed. Is there a way to define the variables in Mbar such that I am ensured that Mbar is positive definite?
I really have no idea what you are trying to do. All of your code is out of order. I think that this is all that you need, though the result is trivial for a diagonal matrix:
which returns
The reason the first case didn't work is because you were using Matlab's default numeric functionality and had not assigned any values to
M,Ixx, etc. You got the error in the second case because you didn't create yourMbarmatrix other than allocate it as all zeros.