ODE45 for Equations of Motion
古いコメントを表示
Hi, I am hoping someone can help me with the following issue. I have tried this problem multiple times and still can't seem to write the correct code (I am new to MATLAB).
The following three equations of motion are to be solved:

theta dot out is the input velocity into the system, it is time dependant and is characterised by the equation:
All other variables are constant (e.g. theta_dot_zero,J1,c1,k1,f (this is not frequency) etc.).
I believe you can use ode45 to solve this however I have had no luck.
Initial conditions can be taken as zero, a timespan of 0-20seconds can be used as an example.
The aim is to then plot velocity, acceleration and displacement graphs for the unknown theta variables of subscript 1,2,n and out.
I hope someone can help with this! I would really appreciate a draft of some code.
Thanks!
8 件のコメント
Steven Lord
2023 年 3 月 21 日
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 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.
Sam Butler
2023 年 3 月 21 日
編集済み: Sam Butler
2023 年 3 月 21 日
Vin and vin are not interpreted as the same variable.
And to use ode45 to solve system (6), you have to rewrite it as a system of first-order differential equations. That means you will have 6 variables to solve for, not 3.
Sam Butler
2023 年 3 月 21 日
Torsten
2023 年 3 月 21 日
I mean that Y0 and dx must be 6x1 vectors, not 3x1 vectors. They should be
Y0 = [theta_1,theta_1_dot,theta_2,theta_2_dot,theta_n,theta_n_dot] and
dx = [theta_1_dot,theta_1_dotdot,theta_2_dot,theta_2_dotdot,theta_n_dot,theta_n_dotdot].
You don't need to solve an additional differential equation for theta_out. If theta_0_dot is a constant and you know theta_0 and theta_out at t=0, it should be no problem for you to integrate the equation theta_out_dot = ... analytically to get theta_out.
Sam Butler
2023 年 3 月 22 日
Do you see the problem why the integration takes so long and is almost impossible to perform ?
param.vin = 600*(2*pi/60); %% 600 is the input velocity in rpm
param.f_mech = param.vin/(2*pi);
theta_out_dot = @(t)param.vin+(0.02*param.vin*cos(72*pi*param.f_mech*t))+(0.005*param.vin*cos(144*pi*param.f_mech*t));
t=0:0.000001:0.1;
plot(t,theta_out_dot(t))
Shree Charan
2023 年 5 月 4 日
@Sam Butler In the question you mention that "theta_dot_out" is the input velocity into the system and "theta_dot_zero" is a constant.
However in the line
theta_out_dot = param.vin+(0.02*param.vin*cos(72*pi*param.f_mech*t))+(0.005*param.vin*cos(144*pi*param.f_mech*t));
theta_dot_zero is replaced with vin which is the input velocity.
Can you please clarify if theta_out_dot = vin as mentioned in the question or if theta_dot_zero = vin.
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Programming についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
