How to find what the value of a variable is in a loop using another variable in the loop?
Show older comments
Hi,
Just trying to figure out how to get a value of a changing value in a loop if I have another value that is also looping. For example, here I am trying to figure out what motor speed a certain torque will give me:
for i=1:2000
%Increase Current through loop
I(i)=-0.1+(i*0.1);
%Calculate RPM with increasing Current
Omega(i)=((Ebat-(I(i)*R))/Ke)/((2*pi)/60);
%Calculate Torque with increasing Current
Torque(i) = Kt * I(i);
%This is my current attempt at getting the motor speed at a certain value of
%torque, however the torque is never exactly equal to TorqueReq which is a %constant
if Torque(i) == TorqueReq
x=MotorSpeed(i)
end
So If I have a certain value for torque, how can I find the corresponding value for speed at that torque? Thanks for any help!
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!