trying to converge a variable/value used in a equation
Ältere Kommentare anzeigen
i am fairly new to matlab and i have been trying to get a variable/value to converge but it looks like i am getting an infinite loop. can someone help me speed it up, tell me what is wrong or suggest a different approach. the following code is in a loop and thetadot is the value im trying to find at that point in time
b = 10;
torque_interation = zeros(1,(size(hx,2)-1));
deltaKE = 100;
thetadot(1,1) = RPS*2*pi();
while abs(deltaKE) > 0.1
q = thetadot(1,1);
torque_interation(1,i) = (work_increment(1,i)*RPS)/q;
% work in - work out = deltaKE
deltaKE = work_increment(1,i) - torque_interation(1,i)*q;
if deltaKE > 0
q = q + b;
elseif deltaKE < 0
b = b/2;
q = q - b;
end
end
thetadot(1,i) = q;
3 Kommentare
Oleg Komarov
am 30 Mai 2011
Post all the relevant details, for example what's RPS.
shaun
am 30 Mai 2011
shaun
am 30 Mai 2011
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Programming finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!