What's the difference between code?

1 Ansicht (letzte 30 Tage)
Francesco
Francesco am 22 Feb. 2014
Kommentiert: Jan am 22 Feb. 2014
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 Kommentar
Jan
Jan am 22 Feb. 2014
Replace for i=3:end by for i = 3:size(out.Y, 2) .

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 22 Feb. 2014
Yes, they appear to be, at least to the limits of round-off error.

Weitere Antworten (0)

Kategorien

Mehr zu App Building finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by