The Python Oracle

How to call GEKKO correctly from Matlab

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Mysterious Puzzle

--

Chapters
00:00 How To Call Gekko Correctly From Matlab
00:49 Accepted Answer Score 3
01:13 Thank you

--

Full question
https://stackoverflow.com/questions/5663...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #matlab #call #ode #gekko

#avk47



ACCEPTED ANSWER

Score 3


Check this link for how to use pyargs in Matlab. Try using m = py.gekko.GEKKO(pyargs('remote' , 'True'));

m = py.gekko.GEKKO(pyargs('remote' , 'True'));
m.time = py.numpy.linspace(0,20,100);
k = 10;
y = m.Var(5.0);
t = m.Param(m.time);
m.Equation(k*y.dt()==-t*y);
m.options.IMODE = 4;
m.solve(disp==True)

time = cellfun(@double,cell(m.time.tolist()));
y = cellfun(@double,cell(y.VALUE.value));
plot(time,y)
xlabel('Time')
ylabel('y')

enter image description here