Fit a function with respect to a cost function
1 view (last 30 days)
Show older comments
I have a function with 4 parameters
and s (p is fixed and s is a vector and also fixed).
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/491580/image.png)
pwr = @(a,b,p,s) b.*(1-e.^(-(a/b).*s))+p;
In addition to that I have a cost function which consits of multiple steps. The result of my pwr function is one of the input parameters.
function cost = computeCost(dist,pwr,s,p,E,alpha)
% two differential equations and some other stuff
end
My goal is to adjust the parameters a and b for given parametrsp and s so that
is in a defined range (
).
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/491585/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/491590/image.png)
I thought about using fmincon and passing the cost function as the nonlcon parameter. But as I'm not trying to mimize the pwr fucntion but the cost function this doesn't seem to be the right way. Does anybody have a hint for me how to do this?
0 Comments
Answers (1)
See Also
Categories
Find more on Nonlinear 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!