Incremental step until condition met
이전 댓글 표시
Hello everyone and thank you in advance.
I don't know how arrange correctly - I guess - the sintax "while, loop, for, if".
In particular, i have a block on a surface that simulate a simple wall and in wich I apply an horizzontal acceleration.
My goal is to focus on this acceleration and the velocity at the top of the block.
So I have a control point at the top where I monitor the speed, and I'd like increment the amount of the horizontal acceleration on the block if the velocity reach 0 within (e.g) 10 seconds.
E.g.:
I start with the value "0.1" of horizontal acceleration and I see the speed on the top. If within 10s reach 0, then I "reset" the initial condition, and I restart the loop (?) with "0.2" etc.
There is a way to do so?


댓글 수: 6
David Hill
2021년 2월 25일
I assume the initial velocity is known. Your problem is somewhat confusing since the arrows are in the same direction. You would need a negative acceleration to slow down a positive initial velocity to zero. A simple equation will solve the problem. No need to iterate.
Steven Lord
2021년 2월 25일
So essentially you're trying to model something like a box on a floor (or maybe a hockey puck on ice?) and you want to give the box a push every time friction with the ground causes it to stop within 10 seconds of the last push?
Francesco Rossetto
2021년 2월 25일
편집: Francesco Rossetto
2021년 2월 25일
Francesco Rossetto
2021년 2월 25일
David Hill
2021년 2월 25일
This is a torque problem. To model properly you need to know the center of gravity (assume the center for uniiform density of block), dimensions of the block, and mass. You talk about applying an acceleration, but in reality you would be applying a force. The block will start moving when the torque at the top overcomes the torque being applied by the block's weight.
Francesco Rossetto
2021년 2월 26일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!