How do I find the quadratic approximation using this equation?
9 views (last 30 days)
Show older comments
I'm trying to find quadratic approximation using the equation:
y = c1*x1^2+ c2*x1*x2+c3*x2^2+a1*x1+a2*x2+b
This equation receives a sampling plan from X = [x1' x2'], observed values y and predicts a quadratic approximation using the above equation. I understand I need to find coefficients first. So far I have gotten here:
X = lhsdesign(20,2)*4-2;
%plot((X(:,1)),(X(:,2)),"*")
%grid on
theta = [c1 c2 c3 a1 a2 b];
A = [(X(:,1))^2, (X(:,1)^2.*(X(:,2))^2,(X(:,2))^2, (X(:,1)),(X(:,2), 1]'
theta = (A'*A)\(A'*y)
There seems to be a problem with matrix A. I have been getting errors about it. Can someone please help me?
1 Comment
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!