Need help setting up my for loop

1 回表示 (過去 30 日間)
daniel choudhry
daniel choudhry 2020 年 10 月 22 日
回答済み: Walter Roberson 2020 年 10 月 22 日
I am having trouble setting my Fx = but is not working
fs = 100; %sampling rate Hz
m = 90; %male subject kg
t = [1/fs:1/fs:length(Fx)/fs];
mfoot = (0.0145)*(m); % kg
g =9.8;
COMx = RANK(:,1) + (RTOE(:,1)-RANK(:,1)/2); %m
COMy = RTOE(:,2) + (RANK(:,2)-RTOE(:,2)/2); %m
dxd = COP(:,1) - COMx;
dyd = COMy;
dxp = COMx - RANK(:,1);
dyp = RANK(:,2) - COMy;
%alpha =
for i = length(Fx)
Rx(:,i) = sum(mfoot*g(:,i));
end

採用された回答

Walter Roberson
Walter Roberson 2020 年 10 月 22 日
g is a scalar. You are trying to use g(:,i) . That is only going to work when i is 1, which would then be g(:,1) which would be the same as g(1,1) which would be the same as the scalar g. But when i reaches 2, g(:,2) is going to fail as there is only one column in g.
Your posted code does not define Fx to have its length() taken.
Oh, and notice that you did not use for i = 1: something, you went for for i = something which is going to do a single iteration with i having the single value defined.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by