I have two same errors every time i paste a code to check
This is my task and here is code:
% Load the x-y-z positions into the variable R
load datafile.mat
m = 1.2; % particle mass in kg
% Find the center of mass location in a row vector rcm
rcm = mean(R);
% Find the moment of inertia matrix I, a 3-by-3 matrix
Ixx = sum(m*(R(:,2).^2+R(:,3).^2));
Iyy = sum(m*(R(:,1).^2 + R(:,3).^2));
Izz = sum(m*(R(:,1).^2 + R(:,2).^2));
Ixy = -sum(m * R(:,1) .* R(:,2));
Ixz = -sum(m * R(:,1) .* R(:,3));
Iyz = -sum(m * R(:,2) .*R(:,3));
% Composite main inertia matrix I
I = [ Ixx, Ixy, Ixz;
Ixy, Iyy, Iyz;
Ixz, Iyz, Izz ];
% Find the principal moment of inertia
[~,II] = eig(I);
and the errors are
I tried many different methods to solve this but non of them worked :/, thanks for any helpThis is my task and here is code:
% Load the x-y-z positions into the variable R
load datafile.mat
m = 1.2; % particle mass in kg
% Find the center of mass location in a row vector rcm
rcm = mean(R);
% Find the moment of inertia matrix I, a 3-by-3 matrix
Ixx = sum(m*(R(:,2).^2+R(:,3).^2));
Iyy = sum(m*(R(:,1).^2 + R(:,3).^2));
Izz = sum(m*(R(:,1).^2 + R(:,2).^2));
Ixy = -sum(m * R(:,1) .* R(:,2));
Ixz = -sum(m * R(:,1) .* R(:,3));
Iyz = -sum(m * R(:,2) .*R(:,3));
% Composite main inertia matrix I
I = [ Ixx, Ixy, Ixz;
Ixy, Iyy, Iyz;
Ixz, Iyz, Izz ];
% Find the principal moment of inertia
[~,II] = eig(I);
and the errors are
I tried many different methods to solve this but non of them worked :/, thanks for any help This is my task and here is code:
% Load the x-y-z positions into the variable R
load datafile.mat
m = 1.2; % particle mass in kg
% Find the center of mass location in a row vector rcm
rcm = mean(R);
% Find the moment of inertia matrix I, a 3-by-3 matrix
Ixx = sum(m*(R(:,2).^2+R(:,3).^2));
Iyy = sum(m*(R(:,1).^2 + R(:,3).^2));
Izz = sum(m*(R(:,1).^2 + R(:,2).^2));
Ixy = -sum(m * R(:,1) .* R(:,2));
Ixz = -sum(m * R(:,1) .* R(:,3));
Iyz = -sum(m * R(:,2) .*R(:,3));
% Composite main inertia matrix I
I = [ Ixx, Ixy, Ixz;
Ixy, Iyy, Iyz;
Ixz, Iyz, Izz ];
% Find the principal moment of inertia
[~,II] = eig(I);
and the errors are
I tried many different methods to solve this but non of them worked :/, thanks for any help moment of inertia, matrix MATLAB Answers — New Questions









