use vpasolve's engine without vpasolve
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Nathan Bblanc
il 7 Mar 2021
Commentato: Nathan Bblanc
il 10 Mar 2021
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 Commenti
Risposta accettata
Steven Lord
il 7 Mar 2021
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.
Più risposte (1)
John D'Errico
il 7 Mar 2021
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 Commenti
Vedere anche
Categorie
Scopri di più su Engines & Motors in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!