use vpasolve's engine without vpasolve
조회 수: 6 (최근 30일)
이전 댓글 표시
I have a function Y=F(X) where x and y are both 1*n vectors. I want to find X such that F(X)=[0,0....0,0]. i tried using fmincon or fminsearch (with the avsolute value of F) but they failed miserably.
one thing that partialy worked was using vpasolve by writing down (for example for n=3):
function Y1=F1(X1,X2,X3)
Y=F([X1,X2,X3])
Y1=Y(1)
end
and similary for F2 F3. then I wrote
syms x y z
vpasolve(0==F1(x,y,z),0==F2(x,y,z),0==F3(x,y,z))
in short, vpasolve worked well but required defining the equations in a weird way.this certainly cannot be used when n=12 for example.
my question is if there is a different function that uses the same engine or a way to access the engine of vpasolve directly. I tried to open vpasolve's source code but couldn't understand it.
would be thankfull for any assistance
댓글 수: 0
채택된 답변
Steven Lord
2021년 3월 7일
If you're trying to find a solution of F, neither fminsearch nor fmincon would be my first choices for functions to use. If F returns a symbolic vector I'd use solve from Symbolic Math Toolbox and if it returns a numeric vector I'd use fsolve from Optimization Toolbox (which you have, since you wouldn't have been able to use fmincon if you didn't.)
Can you show us your F function? Without that information it's going to be difficult if not impossible to offer any suggestions.
추가 답변 (1개)
John D'Errico
2021년 3월 7일
You cannot access vpasolve without using vpasolve. There is no way to access the code for vpasolve.
You cannot use fminsearch on a function with 12 variables. It will converge poorly.
You MAY be able to ue fmincon. While you claim that it failed miserably, is is very possible that you did not know how to use it.
If you have vpasolve, one solution may be simply to learn how to write the equations properly. It sounds like you really just don't understand how to do that. The same applies for fsolve.
But as Steve has said, the real question is what are your equations, not some meaningless contrived set. It is difficult to help you lacking that.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Engines & Motors에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!