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.

 채택된 답변

Star Strider
Star Strider 2021년 11월 6일

1 개 추천

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

JUNTAE PARK
JUNTAE PARK 2021년 11월 7일
Can you check the code?
[t,w]= ode45(@motor_trq,[0 1],w_0)
function [w_dot]=motor_trq(motor_speed , motor_torque , current_speed)
T_max=interp1(motor_speed , motor_torque , current_speed);
w_dot=T_max/J;
end
But, It throws an error,
Maybe i cannot use interp1 in the function??
Star Strider
Star Strider 2021년 11월 7일
Is this code same with below simulink model?
I have not used Simulink in a while, so I am not certain. If it can be put into a block (and I vagurely recall doing that), it should work.
.
JUNTAE PARK
JUNTAE PARK 2021년 11월 7일
Thank you for reply.
But i think MATLAB code still have error. haha
The ode45 call to it has to be —
[t,w]= ode45(@(motor_speed,motor_torque)motor_trq(motor_speed , motor_torque , current_speed), [0 1], w_0)
and the other parameter ‘current_speed’ has to be present in the workspace.
.
JUNTAE PARK
JUNTAE PARK 2021년 11월 7일
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 2021년 11월 7일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 11월 6일

0 개 추천

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

JUNTAE PARK
JUNTAE PARK 2021년 11월 7일
Trq is function of w.
I think this code is not reflect the T=f(w)..

댓글을 달려면 로그인하십시오.

카테고리

제품

질문:

2021년 11월 6일

댓글:

2021년 11월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by