How do I only optimise specific input parameters to a function?

I have a function:
function [ delta_L ] = lift_trim( L_req,psi,phi,a,b,alpha_r,y,q,c_y,Cl_slope,sweep )
w_dash = sum(psi{2}*a,2); theta = sum(phi{1}*b,2); alpha_e = theta*cosd(sweep) - w_dash*sind(sweep); % elastic AoA
delta_L = L_req - trapz(y,q*c_y*Cl_slope*cosd(sweep).*(alpha_r+alpha_e));
I would like to optimise the function to minimise delta_L by optimising a, b, and alpha_r. I looked up fsolve and it has the form X = fsolve(FUN,X0). So assuming X0 is [a0;b0;alpha_r0] how do i then let the function know the other variable values that have not to be altered during the optimisation?
I have not used many optimisation functions so forgive me if this is a stupid question.
Many thanks in advance.

Antworten (1)

That's a fairly common requirement in optimization. You can pass the extra arguments through an anonymous function as explained in this link:
@(x)lift_trim( L_req,psi,phi,x(1),x(2),x(3),y,q,c_y,Cl_slope,sweep)
pass the above to fsolve or any other optimization routine you are using. Notice that I have replaced the a b and alpha_r by x indexed

Kategorien

Mehr zu Chemistry finden Sie in Hilfe-Center und File Exchange

Produkte

Gefragt:

am 23 Feb. 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by