How can I make spring code??
显示 更早的评论
When a spring is stretched, it will begin oscillating up and down until friction or air resistance eventually brings it to a stop. • If a block is placed on the end of the spring, its position, y(t), is found by solving the following second-order ODE: • In the this equation k and b are both constants that represent the stiffness of the spring and the amount of air resistance encountered by the block, respectively. • Condition ✓
m = 0.05 kg , b = 0.5 kg/s and k = 50 N/m ✓
The spring is initially stretched 0.1m away from its unstretched length and the block is released from rest at that position.
𝒎 ∙ 𝒅^ 𝟐 𝒚 𝒅𝒕^ 𝟐 + 𝒃 ∙ 𝒅𝒚 𝒅𝒕 + 𝒌 ∙ 𝒚 = 0
*condition
- use ode45
- tRange = [0 1];
- use 'motion' function
1 个评论
Steven Lord
2022-5-11
This sounds like a homework assignment. If it is, show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the free MATLAB Onramp tutorial (https://www.mathworks.com/support/learn-with-matlab-tutorials.html) to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Assembly 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!