How do I only optimise specific input parameters to a function?
Afficher commentaires plus anciens
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.
Réponses (1)
Shashank Prasanna
le 23 Fév 2013
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
Catégories
En savoir plus sur Chemistry dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!