how to form feedback loop to change input?

2 vues (au cours des 30 derniers jours)
Shubham Mohan Tatpalliwar
Shubham Mohan Tatpalliwar le 17 Oct 2018
if true
% code
DrehzahlICE = 1000;
DrehzahlEMB = 1724
DrehzahlEMA = -258
DrehmomentAchsesoll= 324
DrehmomentICEmax=94
DrehmomentAchseist=DrehmomentICEmax*1.54*2.64
DrehmomentEMA = round(DrehmomentICEmax*0.53)
Drehmomentbrauch=DrehmomentAchsesoll-DrehmomentAchseist
LeistungEMA=(2*pi*DrehzahlEMA.*DrehmomentEMA)/60
LeistungEMB=-LeistungEMA;
DrehmomentEMB=(LeistungEMB*60)./(2*pi*DrehzahlEMB)
if Drehmomentbrauch<0 & DrehzahlEMA<0 & DrehmomentEMB>0
Dm=abs(Drehmomentbrauch)+ abs(DrehmomentEMB*3.07*2.64)-(DrehmomentEMA*2.64)
end
In this code (output)Dm=-13
but expected output is zero
That can be obtained by increasing first input i.e. DrehzahlICE=1000 to 1020
how can i take a feedback that Dm is not between -1 to 1
and DrehzahlICE should increase at the step of 1

Réponse acceptée

Adam
Adam le 17 Oct 2018
Put the relevant part of the code in a while loop with the condition
while Dm < -1 || Dm > 1
% Your main code here
DrehzahlICE = DrehzahlICE + 1
end
  1 commentaire
Shubham Mohan Tatpalliwar
Shubham Mohan Tatpalliwar le 18 Oct 2018
Modifié(e) : Shubham Mohan Tatpalliwar le 18 Oct 2018
how should i to show only final answer

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by