Asked by Alexander
on 8 May 2013

I have an emperical formula RR = P^x **Z^y** (a + b *V + c *V^2 ).
x,y are regression exponents
a,b,c are regression constants
P,Z,V are variables such that RR=f(P,Z,V)

I have data that relates RR and P,Z,V. Is it possible to fit this data to this particular formulae using matlab 2011? if so are there any similar tuitorial or helpful videos?

Thank you in advance.

*No products are associated with this question.*

Answer by Matt J
on 10 May 2013

Accepted answer

FMINSPLEAS from the File Exchange would be worth a try

http://www.mathworks.com/matlabcentral/fileexchange/10093-fminspleas

It will let you take advantage of the fact that the equation has a linear dependence on some of your parameters (a,b,c) and nonlinear dependence on other parameters (x,y) to do a more efficient fit.

Alexander
on 10 May 2013

As you advised, I've downloaded the fminpleas function.

%Example 2 from the fminpleas file%

x = rand(500,1);

y = 4 - 3*sin(2*x) + 2*cos(3*x) + randn(size(x))/10;

funlist = {1, @(c,xdata) sin(c(1)*xdata), @(c,xdata) cos(c(2)*xdata)};

[INLP,ILP] = fminspleas(funlist,[3 4],x,y)

What is the purpose of the function handle 'funlist' in the above program;How does it relate to 'y'? What must I do with the INLP and INL values?

Matt J
on 10 May 2013

funlist specifies the nonlinear parts of the terms in the model equation, or if there is a purely linear term, you put funlist{i}=1. So, the above example corresponds to a model equation,

y=A+ B*sin(c(1)*x) + C*cos(c(2)*x)

where the unknowns are A,B,C, c(1) and c(2). The coefficients A,B,C are what the fminspleas documentation calls Intrinsically Linear Parameters (ILP) because the model equation depends on those linearly. Conversely, lower case c is an Intrinsically Non-Linear Parameter (INLP) vector. fminspleas returns these as 2 separate output argument vectors. So, if the fit succeeds, then this

[INLP,ILP] = fminspleas(funlist,[3 4],x,y)

will give you INLP=[2,3] and ILP=[4,-3,2].

Answer by Matt J
on 8 May 2013

Edited by Matt J
on 8 May 2013

Your equations are linear in the unknowns a,b,c. Use any MATLAB linear equation solver to find them, e.g.,

Show 4 older comments

Matt J
on 10 May 2013

**I am sorry but I still don't follow you when you say that the equation I specified with three variables, all raised to the unknown power >1, is a Linear equation**

I was under the impression that a,b,c were the only unknowns. I did not see that x,y were also unknowns. If a,b,c were the only unknowns and all the rest were knowns or constants, I think you can see that the equation is linear w.r.t. the unknowns a,b,c

Since x,y are also unknowns, neither my suggestion, nor Tom's suggestion of POLYFIT will work. See my new Answer, suggesting fminspleas, however.

Related Content

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

Learn moreOpportunities for recent engineering grads.

Apply Today
## 0 Comments