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
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!