I would like to call Matlab's ode45 function from python just like MATLAB's isprime() function is called in the following python code
import matlab.engine
eng = matlab.engine.start_matlab()
tf = eng.isprime(37)
print(tf)
but I don't really know how to implement the code in python. I've tried
import matlab.engine
def dydt(t,y):
dydt= 2*y
return dydt
eng = matlab.engine.start_matlab()
T,Y=eng.ode45(dydt,[0, 20],[2, 0])
and it returned :
line 73, in call out=_stdout, err=_stderr)
TypeError: unsupported Python data type: function.
I've already installed the MATLAB Engine API for Python according to the following link https://www.mathworks.com/help/matlab/matlab_external/install-the-matlab-engine-for-python.html and tested it successfully using examples in the following link https://www.mathworks.com/help/matlab/matlab_external/call-matlab-functions-from-python.html .
I found the following thread that might be relevant Imitate ode45 function from MATLAB in Python but from what I see they just used python's libraries to solve the ODEs and don't call the MATLAB's ODE45 from python. Maybe I just don't understand that correctly.
Could anyone help me make progress with that issue? Thanks!