Calculation not having the desired array size
I am trying to calcumate the Acceleration using a rotational matrix, during the loop the left side is a 3×14074 (good), but the right is (3×3) which I don’t want. How can I fix this so the right side has a matching size? Thanks
% Acc and AngV are sensor data sets and have sizes of 14074×3
% qF is 3x3x14074
g = [0,0,9.81];
xn = zeros(3, length(Acc));
fuse = imufilter(‘SampleRate’,100,’DecimationFactor’,1);
q = fuse(Acc, AngV);
qF = quat2rotm(q);
for i=1:length(AngV)
xn(1:3,:) = qF(:,:,i) .* Acc(i,:)’ – g; % This is where the error arises
end
vi = xn .* dt;
ri = .5 * xn .* (dt^2);
I’ve tried every combination of transforms and reordering that I could think of, everything gives 3×3 or 3×1. Somehow I used to have this work for me, then I woke up and bam, its broken.
Error:
Unable to perform assignment because the size of the left side is 3-by-14074 and the size of the right side is 3-by-3.
Error in RunKalman (line 27)
xn(1:3, 🙂 = qF(:, :, i)’ .* Acc(i, :)’ – g;I am trying to calcumate the Acceleration using a rotational matrix, during the loop the left side is a 3×14074 (good), but the right is (3×3) which I don’t want. How can I fix this so the right side has a matching size? Thanks
% Acc and AngV are sensor data sets and have sizes of 14074×3
% qF is 3x3x14074
g = [0,0,9.81];
xn = zeros(3, length(Acc));
fuse = imufilter(‘SampleRate’,100,’DecimationFactor’,1);
q = fuse(Acc, AngV);
qF = quat2rotm(q);
for i=1:length(AngV)
xn(1:3,:) = qF(:,:,i) .* Acc(i,:)’ – g; % This is where the error arises
end
vi = xn .* dt;
ri = .5 * xn .* (dt^2);
I’ve tried every combination of transforms and reordering that I could think of, everything gives 3×3 or 3×1. Somehow I used to have this work for me, then I woke up and bam, its broken.
Error:
Unable to perform assignment because the size of the left side is 3-by-14074 and the size of the right side is 3-by-3.
Error in RunKalman (line 27)
xn(1:3, 🙂 = qF(:, :, i)’ .* Acc(i, :)’ – g; I am trying to calcumate the Acceleration using a rotational matrix, during the loop the left side is a 3×14074 (good), but the right is (3×3) which I don’t want. How can I fix this so the right side has a matching size? Thanks
% Acc and AngV are sensor data sets and have sizes of 14074×3
% qF is 3x3x14074
g = [0,0,9.81];
xn = zeros(3, length(Acc));
fuse = imufilter(‘SampleRate’,100,’DecimationFactor’,1);
q = fuse(Acc, AngV);
qF = quat2rotm(q);
for i=1:length(AngV)
xn(1:3,:) = qF(:,:,i) .* Acc(i,:)’ – g; % This is where the error arises
end
vi = xn .* dt;
ri = .5 * xn .* (dt^2);
I’ve tried every combination of transforms and reordering that I could think of, everything gives 3×3 or 3×1. Somehow I used to have this work for me, then I woke up and bam, its broken.
Error:
Unable to perform assignment because the size of the left side is 3-by-14074 and the size of the right side is 3-by-3.
Error in RunKalman (line 27)
xn(1:3, 🙂 = qF(:, :, i)’ .* Acc(i, :)’ – g; matrix manipulation, matrix array MATLAB Answers — New Questions
​