Guassian Function, for loop only runs once???
Ältere Kommentare anzeigen
a=[A,B];
for i=1:4;
a(2,i)=a(2,i)-(a(2,1)/a(1,1)).*a(1,i)
end
This is one of my first lines in my function but I do not know what this for loop only runs once A is a 3X3 matrix and B is a 3X1 which I combined for an augmented matrix
2 Kommentare
Adam Danz
am 4 Feb. 2019
The four-loop definitely runs 4 times.
As evidence, insert this line anywhere inside your for-loop and the iteration number will be displayed in the command window.
fprintf('iteration #%d\n', i)
Only the 2nd row of 'a' will be affected by your code. Perhaps that's causing unexpected results?
Abigail Osborne
am 4 Feb. 2019
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!