# Can I use "fitnlm" for multiple regression ? and How?

10 views (last 30 days)
Riyadh Muttaleb on 25 Mar 2019
Commented: Riyadh Muttaleb on 26 Mar 2019
Hi everybody,
I have mutiple nonlinear regression like (x1,x2,x3 and y) the equation is "y=x1+x2^n+x3^n" , where n is known, , can I use "fitnlm" function and how can set up it?
Riyadh Muttaleb on 26 Mar 2019
I wrote the equation that I want to solve, the regeression gives the constants (a,b,c, and d)
y=a+b*x1+c*x2^n+d*x3^n;
IF this equation can be solved with "fitnlm" PLEASE let me know how? n is fractional (from 0.1-3)

dpb on 25 Mar 2019
Well, I take that back...actually you could do it with fitlm if you do a change of variable...
u1=x2.^n;
u2=x3.^n;
t=table(x1,u1,u2,y);
lm=fitlm(t,'y~x1+u1+u2');
I've used fitlm very little, so I'm sorta' shootin' in the dark, but I believe that's correct.
I can't figure out the doc to use the variables outside the table; it's the most confusing description and lacking in useful examples... :(
dpb on 26 Mar 2019
Sure,
lm=fitlm([x1 x2 x3],y)
where x2=x^n, x3=u^n