How to update during ODE45

2 views (last 30 days)
JUNTAE PARK
JUNTAE PARK on 6 Nov 2021
Commented: Star Strider on 7 Nov 2021
I want get a function, which is related with motor.
[t,w]=ode45(@(t,w) -Trq/J*t, t_span, w_0)
But motor maximum torque(Trq) is related with motor speed.
Is there any method to change Trq durring ODE45??
Trq is changed by w.

Accepted Answer

Star Strider
Star Strider on 6 Nov 2021
If the relationship between torque and speed (angular veolcity) is known and can be modeled (expressed mathematically), create a function that expresses that relationship and then call it appropriately in the ODE function that is used as an argument to ode45.
.
  6 Comments
JUNTAE PARK
JUNTAE PARK on 7 Nov 2021
Ah,
At first, current_speed is w_0.
and next step, current_speed should be updated from w in [t,w].
Star Strider
Star Strider on 7 Nov 2021
It will be necessary to create a function of ‘t’ that returns the desired output at that time and speed (angular velocity).
I leave that to you.
Experiment with it first in MATLAB, then transfer it to Simulink, if that is the desired end result.

Sign in to comment.

More Answers (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 6 Nov 2021
This can be computed with a [for .. end] loop, e.g.:
clc;
clearvars
w = ...;
Trq = 10*w; % E.g.
w_0 = -1.5; % E.g.
J = 150; % E.g.
t_span=[0, 13]; %
for ii=1:numel(Trq)
[t,ww]=ode45(@(t,w)(-Trq(ii)/J*t), t_span, w_0);
plot(t,ww), hold all
Time{ii}=t;
W{ii} =ww;
end
  1 Comment
JUNTAE PARK
JUNTAE PARK on 7 Nov 2021
Trq is function of w.
I think this code is not reflect the T=f(w)..

Sign in to comment.

Categories

Find more on Programming in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!