How to do regression between three inputs (x1, x2 and x3) and one outputs (y) using Curve Fitting?
7 views (last 30 days)
Show older comments
How to do regression between three inputs (x1, x2 and x3) and one outputs (y) using Curve Fitting? The Cuve fittinng show only regression between x1, x2 inputs and z outputs
0 Comments
Answers (2)
Star Strider
on 8 Jun 2015
I don’t have the Curve Fitting Toolbox (Statistics and Optimization instead), so I can’t address the Curve Fitting Toolbox specifically. However it is straightforward to do this with the other functions, by combining the three vectors into one matrix, then addressing them appropriately in your objective function:
x123 = [x1(:), x2(:), x3(:)];
y = [column vector with the same row size as ‘x123’];
f = @(b,x) b(1).*x123(:,1).^b(2) + b(3).*x123(:,2) + x123(:,3); % Example Objective Function
B0 = [choose vector of initial parameter estimates];
B = nlinfit(x123,y,f,B0); % Estimate Parameters
You will have to experiment with the Curve Fitting Toolbox, but since it can use custom objective functions, something like this should work.
0 Comments
See Also
Categories
Find more on Linear and Nonlinear Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!