What's the difference between code?

2 ビュー (過去 30 日間)
Francesco
Francesco 2014 年 2 月 22 日
コメント済み: Jan 2014 年 2 月 22 日
It's a stupid question but these two line of code do the same thing wthere dt1 is a constant. Is it right?
prova= sum((out1.Y{i}(:,3:end)).^2)*dt1;
h=1;
for i=3:end;
y1=out.Y(:,i);
prova(h)=sum(y1.^2)*dt1;
h=h+1;
end;
  1 件のコメント
Jan
Jan 2014 年 2 月 22 日
Replace for i=3:end by for i = 3:size(out.Y, 2) .

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2014 年 2 月 22 日
Yes, they appear to be, at least to the limits of round-off error.
  1 件のコメント
Francesco
Francesco 2014 年 2 月 22 日
Ok ok. I just wanted a confirmation.

サインインしてコメントする。

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by