Why Matlab does not read the input value?

조회 수: 2 (최근 30일)
Federico Ferrara
Federico Ferrara 2020년 8월 13일
답변: Jan 2020년 8월 13일
Hello to everyone, I've got this problem with a programm that deal with autonomous driving...In particular within the function that take into account the acceleration of the leader vehicle, i'm trying to implement a constant deceleration of the vehicle from a cruice velocity of 10 m/s to 0. But in this case I'm considering that the car is not riding on a flat path but along a slope. I would like to have a deceleration of 0.1 regardless the grade.
t_stop=100;
slope_perc=input('put the % value of the slop= ');
theta=atan(slope_perc/100);
delta=0.1 +9.81*sin(theta);
if t<t_stop
alead=-9.81*sin(theta)-delta;
else
alead=0;
end
When I run the code matlab asks me "put the % value of the slope= " but when I insert the value, the programm doesn't go on and keeps asking always to put the value...I know that you should read all the code but, according to you, have I write something wrong? Thanks.
  댓글 수: 2
Matt J
Matt J 2020년 8월 13일
편집: Matt J 2020년 8월 13일
Here's what I get,
put the percentual value of the slope= 3
Undefined function or variable 'pendenza_perc'.
Error in test (line 3)
theta=atan(pendenza_perc/100);
Federico Ferrara
Federico Ferrara 2020년 8월 13일
i've corrected the word, sorry, it was written in italian before

댓글을 달려면 로그인하십시오.

답변 (1개)

Jan
Jan 2020년 8월 13일
This piece of code is called repeatedly. This shown code seems to be fine, so the behavior is caused the code, which calls this piece.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by