Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Fminsearch doesnt minimize my function please help

Subject: Fminsearch doesnt minimize my function please help

From: Saad

Date: 6 Aug, 2011 10:22:13

Message: 1 of 2

Dear All,

I am using fminsearch to minimize this function:

function Yield_Final = bond3(def_ind)


global sig
global beta
global alpha

global dis_free


  N=51;
  Bonds=zeros(1,N);
 %%%constant%%%%
f_b=0.01;
f_gb=0.02;
K=(1+ f_b + f_gb);

phi=sqrt(2*sig^2*K + beta^2);

k=(beta + phi)/( beta-phi);
t=0;
dt=1/360;
T=50;
%%%%Loop%%%%%

  summm3=0;

for i=5:5:50
    
    
a1_a(1,i+1)=((1-k)/(1-k*exp(phi*((i+1)./5-t))))^(2*alpha/(sig^2)) * exp(alpha*(beta+ phi)*((i+1)./5-t)*(1/sig^2));

a2_a(1,i+1)=((phi-beta)/(sig^2*K))+ (2*phi/(sig^2*K*(k*exp(phi*((i+1)./5-t))-1)));

def(1,i+1)=a1_a(1,i+1-t)* exp(-a2_a(1,i-t)*def_ind*K);

 summm3= summm3+ def(1,i+1)


end

    Yield_Final=summm3;
    
I would like to minimize this function with respect to the parameter "def_ind" but my function doesnt minimize. IS it because of the loop? my function is the sum of "def"...so it is one value but the parameters is inside the loop and i dont understand why the function doesnt change value when fimisearch algorithm runs..Please any help or suggestion would very welcomed thanks a lot

S
 
    
    
   

Subject: Fminsearch doesnt minimize my function please help

From: Matt J

Date: 6 Aug, 2011 15:56:10

Message: 2 of 2

"Saad " <saad.badaoui07@imperial.ac.uk> wrote in message <j1j4kl$8lc$1@newscl01ah.mathworks.com>...
>
>
> I would like to minimize this function with respect to the parameter "def_ind" but my function doesnt minimize. IS it because of the loop? my function is the sum of "def"...so it is one value but the parameters is inside the loop and i dont understand why the function doesnt change value when fimisearch algorithm runs..Please any help or suggestion would very welcomed thanks a lot
===============

The graph of your function is flat. Therefore, it is already minimized. See

http://www.mathworks.com/matlabcentral/newsreader/view_thread/311248#848240

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us