Issues in using matlab in python
조회 수: 6(최근 30일)
표시 이전 댓글
Ajai Singh 2022년 8월 17일
편집: Ajai Singh 2022년 8월 17일
Hello everyone ,
I am trying to solve an optimization problem where the input to the function to be optimized is a 12x1 vector and the output is a matrix of size 6x3.
I tried solving this using fsolve, root solvers from scipy.optimize
but got the following error:
fsolve: there is a mismatch between the input and output shape of the 'func' argument 'f'.Shape should be (12,) but it is (6,3).
but this problem can be easily solved in matlab using fsolve.
So i created a very simplified version of the original problem :
eng = matlab.engine.start_matlab()
import numpy as np
func = lambda x: x**2 + x**2 -25
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\reach\anaconda3\envs\MyEnv\lib\site-packages\matlab\engine\matlabengine.py", line 66, in __call__
TypeError: unsupported Python data type: function
Any suggestion would be of great help.
댓글 수: 0
Find more on Systems of Nonlinear Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!