How to create a loop so i can compare accuracy of output values?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
James Dean
am 1 Apr. 2016
Kommentiert: Image Analyst
am 3 Okt. 2020
I need to create a loop so that the process repeats itself until the output value is within a certain accuracy eg 10%
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 1 Apr. 2016
Try this
loopCounter = 1;
maxIterations = 1000000; % or whatever would be the highest you ever expect.
tolerance = 0.001; % Whatever you want.
while loopCounter < maxIterations && difference1 < tolerance && difference2 < tolerance
difference1 = abs(yourValue1 - targetValue1);
difference2 = abs(yourValue2 - targetValue2);
% Now have code to update yourValues and get new ones.
yourValue1 = ......
yourValue2 = ......
loopCounter = loopCounter + 1; % Increment loop counter
end
8 Kommentare
Image Analyst
am 3 Okt. 2020
How do you want to show them? Maybe with fprintf()? Maybe on a graph with yline()? I have no idea what you want. It's best to start your own question with your own data and code.
Weitere Antworten (1)
swapna subudhiray
am 1 Okt. 2020
how to write a for loop for accuracy vs no of iteration?
0 Kommentare
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements 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!