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:
Minimise functions with 3 variables

Subject: Minimise functions with 3 variables

From: Andrea

Date: 9 Apr, 2013 20:16:05

Message: 1 of 2

Dear all
I have the following function in matlab:

function modelYData=modelFun(R,d,C,x)

nPoly=2;
fOld=normcdf(d/2-C);
fNew=normcdf(-d/2-C);

modelHits=R+(1-R)*fOld;
modelFa=fNew;
[pModel,SModel]=polyfit(modelFa,modelHits,nPoly);
modelYData=polyval(pModel,x);

end

I need to find the values for R (single integer); d(single integer) and C (vector of five elements in the from of 5 equally spaced integer with distance of 0.5) which minimise the function (which is a curvilinear function).

I tried different methods like fmincon and lsqcurvefit, but I was not able to make them work with so many variables.

I really appreciate if someone can give me an help.

Subject: Minimise functions with 3 variables

From: Andrea

Date: 10 Apr, 2013 08:00:13

Message: 2 of 2

I forgot to mention 2 important point:

- I need to fit the function to some data I collected so by minimising I meant finding the values of
R
d
C
which give me the minimum sum of squares error in fitting this function to the data.

Also, in my previous message there is an imperfections. The function as only 1 variable which is x, but 3 parameters. The main issue is that one parameter - C - must assume 5 values with the only constrain that this 5 values are equally spaced with a distance of 0.5.

Thanks
Best
Andrea

Tags for this Thread

No tags are associated with 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