In the following script, shifting the % symbols to the line below where they are shown givies different results. The version shown below gives the correct result. The versison with the % signs moved gives an incorrect result. Any ideas?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Fred
am 27 Sep. 2013
Kommentiert: Image Analyst
am 27 Sep. 2013
% trajetory 1
clf
xx=1:10;y=[1 0 0 0 0 0 0 0 1 0];stem(xx,y)
hold on
m = .1;
xz(1) = 11;
y(1) = 1.1;
for i = 1:10
%xz(i) = xz(1) - i;
xz(i) = 11 - i;
%y(i) = y(1) - m*xz(i);
y(i) = 1.1 - m*xz(i);
end
plot(xz,y)
1 Kommentar
Image Analyst
am 27 Sep. 2013
Again? A third post on the same question? This tells me that a reply to Fred is a complete waste of time.
Akzeptierte Antwort
Walter Roberson
am 27 Sep. 2013
The commented out code modifies xz(1) when "i" is 1, so when "i" is 2 or more, xz(1) is no longer the same as what it started out as.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!