我想使用一组四元数数据来创建一个数组,并且我希望在一个循环中填充这个数组。问题是,我不能使用常规的方法来填充数组的四元数数据。我怎样才能把它纠正过来?
这就是我试过的
for ii=1:size(acc,1)
% quaternion data
qahrs = ifilt(acc(ii,:), gyro(ii,:), mag(ii,:));
% supposed to be an array of quaternions
orientation(ii) = qahrs;
end发布于 2019-06-23 08:06:38
我已经解决了,伙计们!这是解决办法
orientation = zeros('quaternion');
for ii=1:size(accCopy,1)
qahrs = ifilt(accCopy(ii,:), gyro(ii,:), mag(ii,:));
orientation(ii,1) = qahrs;
end发布于 2019-06-21 19:03:35
它取决于四元数数据的大小。如果单个四元数是(4x1),那么:
orientation = zeros(4,n)
for ii=1:size(acc,1)
% quaternion data
qahrs = ifilt(acc(ii,:), gyro(ii,:), mag(ii,:));
% supposed to be an array of quaternions
orientation(:,ii) = qahrs;
end如果是(1x4)
orientation = zeros(n,4)
for ii=1:size(acc,1)
% quaternion data
qahrs = ifilt(acc(ii,:), gyro(ii,:), mag(ii,:));
% supposed to be an array of quaternions
orientation(ii,:) = qahrs;
end我假设n是四元数。
https://stackoverflow.com/questions/56702945
复制相似问题