fminbnd: setting constraint to function value to be positive
3 views (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Optimization 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!