How to convert simulink based Reinforcement learning environment to function or script based.

조회 수: 1 (최근 30일)
Hi
I followed water tank model for reinforcement learning.
Since it is based on simulink , is there a way to implement this example in function or script based. I do not intend to use simulink.
Looking forward to hear from you.
Thanks
Chetan

채택된 답변

Sam Chak
Sam Chak 2023년 8월 31일
I believe you can create a MATLAB function to describe the water level in a pump-driven storage tank, and then utilize it to construct the MATLAB Reinforcement Learning Environment.
tspan = [0 20];
h0 = 0.2; % initial height of water level
[t, h] = ode45(@watertank, tspan, h0);
plot(t, h), grid on
xlabel('Time'), ylabel('Water level')
% Water Tank System
function dhdt = watertank(t, h)
A = 1; % cross-sectional area of the tank
a = 1; % constant related to the flow rate out of the tank
b = 1; % constant related to the flow rate into the tank
V = 1; % voltage applied to the pump
dhdt = - a/A*sqrt(h) + b/A*V;
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Reinforcement Learning에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by