Problem fonction while in Simulink
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Ältere Kommentare anzeigen
Hello i'm student and i need to programm the speed of a motor for calculate a battery's autonomy. My motor need to accelerate in first time(to pass 20km/h at 50 mk/h), to stay during 4 sec at 50 km/h, to decelerate to 20 km/h in third time, and for finish to stay during 4 sec at 20km/h. But i don't arrive to simule this in a programm and repeat it until my battery's autonmy pass under 0.2 (20%). If you can help me, i test to do this in matlab function (Simulink)
function u = fonc(a,b,c,d,e)
%u=motor speed
%a=50 km/h
%b=20 km/h
%c=braking time
%d=clock
%e=pourcent of my battery
a=a/3.6/0.2032; %rad/s
b=b/3.6/0.2032; %rad/s
f=(a-b)/c;
while e>0.2
if d<c
u=b+(f*d);
end
if u>a
u=a;
end
if d>8
u=a-(f*(d-8);
end
if u<b
u=b;
end
end
Antworten (1)
Azzi Abdelmalek
am 29 Apr. 2016
0 Stimmen
If e>0.2, you will have an infinite while loop.
Diese Frage ist geschlossen.
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!