Problem fonction while in Simulink
Información
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
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
Respuestas (1)
Azzi Abdelmalek
el 29 de Abr. de 2016
0 votos
If e>0.2, you will have an infinite while loop.
La pregunta está cerrada.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!