fminbnd: setting constraint to function value to be positive
Afficher commentaires plus anciens
Varying the variable 'jtot' I would like to find the inertia that gives me the specified rms-torque-value 'trmsduty'. Therefore I search for zero difference between trmsduty and the function specifying the rms value depending on 'jtot'. First I tried using fzero, this didn't work as there was a complex function value found. Now I try using fminbnd. I set up the following optimization routine :
function [jtotmax] = solve_torque()
[trmsduty,ji,omegadot,tres,k,jtrasm,jmot] = ex2_sin();
f =@(jtotmax) trmsduty^2 -(1/1200).*(trapz(power([jtotmax.*omegadot(1:401)+tres zeros(1,199) ji.*omegadot(601:1001) zeros(1,199)],2)));
[jtotmax,fval] = fminbnd(f,0,.001);
%jtotmax = fzero(f,0.001)
jmmax = jtotmax-jtrasm-jmot;
mmax = jmmax*k;
end
I find the problem, that the minimum of f is a negative value. I'm looking for a way to set the constraint that fval can only be positive (close to zero...).
3 commentaires
dpb
le 15 Juin 2017
Have you looked at the result of your function over the independent variable you're trying to solve for? Is there a feasible solution at all?
As written, nobody here can run it to try anything as we don't have ex2_sin
Karl
le 15 Juin 2017
John D'Errico
le 15 Juin 2017
You cannot set a constraint on the function value using fminbnd.
Réponses (0)
Catégories
En savoir plus sur Optimization dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!