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!