# Problem related to fminbnd

3 views (last 30 days)
Prajakta Ghatage on 23 Feb 2020
Commented: Matt J on 23 Feb 2020
I am finding the minimum value of Lr in the non-linear function. but whatever value of constants I change there is no effect on the minimum value. Also the minimum value I am getting is not correct.
fun=@(Lr)(((Vin*Cr*Lm)/(((((Z*Cc)+((A+(B*Cr))*((B*Cr)+C)*Lr))/Cc)+((ilm*ilm*Lm*Cc)/(((Z*Cc)+((A+(B*Cr))*((B*Cr)+C)*Lr))/Cc)))*(((1-D)*Ts)-((ilm*Lm)/(((Z*Cc)+((A+(B*Cr))*((B*Cr)+C)*Lr))/Cc)))))+((Lr*(((((Z*Cc)+((A+(B*Cr))*((B*Cr)+C)*Lr))/Cc)+((ilm*ilm*Lm*Cc)/(((Z*Cc)+((A+(B*Cr))*((B*Cr)+C)*Lr))/Cc)))*(((1-D)*Ts)-((ilm*Lm)/(((Z*Cc)+((A+(B*Cr))*((B*Cr)+C)*Lr))/Cc)))))/(Lm*Vin))+((C*Lr)/Vin));
[Lr,fval] = fmincon(fun,0,10e-6)
where all other variables are constants and their resp. values are given

Matt J on 23 Feb 2020
Edited: Matt J on 23 Feb 2020
You could plot the function to see how its shape varies with the parameters and to confirm whether fminbnd is giving the correct result.

Matt J on 23 Feb 2020
Can you attach the .mat file where you made the changes.
Do you mean the .m file with the code? A .mat file is not code. It is a data file, generated by the save command,
Here is the complete code that I used:
clear
%% given specifications
D=0.5411;
Vin=28;
Lm=170e-6;
Ts=1.11e-6;
Io=3;
n=3.0303;
Cc=3e-9;
Cr=64e-12;
P=[1e-6 2e-6 3e-6 4e-6 5e-6 6e-6 7e-6 8e-6 9e-6 10e-6]
ilm=0.0989;
Vcc=(D/(1-D))*Vin;
Z=Vcc;
A=((Vin*D*Ts/Lm)+(Io/n))/Vcc;
B=Vin*Vin/(Vcc*Vcc*Lm*A);
C=Io/n;
fun=@(Lr)(((Vin*Cr*Lm)/(((((Z*Cc)+((A+(B*Cr))*((B*Cr)+C)*Lr))/Cc)+((ilm*ilm*Lm*Cc)/(((Z*Cc)+((A+(B*Cr))*((B*Cr)+C)*Lr))/Cc)))*(((1-D)*Ts)-((ilm*Lm)/(((Z*Cc)+((A+(B*Cr))*((B*Cr)+C)*Lr))/Cc)))))+((Lr*(((((Z*Cc)+((A+(B*Cr))*((B*Cr)+C)*Lr))/Cc)+((ilm*ilm*Lm*Cc)/(((Z*Cc)+((A+(B*Cr))*((B*Cr)+C)*Lr))/Cc)))*(((1-D)*Ts)-((ilm*Lm)/(((Z*Cc)+((A+(B*Cr))*((B*Cr)+C)*Lr))/Cc)))))/(Lm*Vin))+((C*Lr)/Vin));
[Lr_opt,fval]=fminbnd(fun,0,10e-6,optimset('TolX',1e-10));
%% Plot the function and mark its minimum, as found by fminbnd
fplot(fun,[0.5,4]*1e-6);
hold on; plot(Lr_opt,fval,'rx','MarkerSize',10); hold off
ylim([0.8,1.7]*1e-7)
title("Variation with Lr")
xlabel("Lr")
ylabel("Interval II")
shg
Prajakta Ghatage on 23 Feb 2020
Thank you so much.
Matt J on 23 Feb 2020