Incremental step until condition met
Mostra commenti meno recenti
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 Commenti
David Hill
il 25 Feb 2021
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
il 25 Feb 2021
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
il 25 Feb 2021
Modificato: Francesco Rossetto
il 25 Feb 2021
Francesco Rossetto
il 25 Feb 2021
David Hill
il 25 Feb 2021
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
il 26 Feb 2021
Risposte (0)
Categorie
Scopri di più su Loops and Conditional Statements in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!