trying to converge a variable/value used in a equation
Show older comments
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 Comments
Oleg Komarov
on 30 May 2011
Post all the relevant details, for example what's RPS.
shaun
on 30 May 2011
shaun
on 30 May 2011
Accepted Answer
More Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!