필터 지우기
필터 지우기

least squre data fit for a function of two variables

조회 수: 2 (최근 30일)
Arun Jose
Arun Jose 2013년 12월 19일
편집: Matt J 2013년 12월 19일
z=f(x,y) is my function.but i know data points (x ,y) and corresponding z values only. I know that z is of the form z=a*g(x,y)+b*h(x,y) i want find a,b in a least square sense. Can i use 'lsqcurvefit' function?? If i can't what can i use?? note: Z is not linear
for example
xdata = [1 4;2 5;3 6];%%f(1,4)=11 f(2,5)=2 f(3,6)=63
ydata = [11;32;63];
x = lsqcurvefit(@myfunction, [1 7], xdata, ydata);
function f=myfunction(x,xdata)
f = f = x(1)*(xdata(:,1)*xdata(:,2))+x(2)*(xdata(:,1))^2;
is not working

답변 (2개)

David Sanchez
David Sanchez 2013년 12월 19일
Use the curve fitting toolbox
cftool
take a look at
doc cftool

Matt J
Matt J 2013년 12월 19일
편집: Matt J 2013년 12월 19일
note: Z is not linear
Z is linear as a function of a and b and that's the only dependence that matters. You don't need any fancy solvers:
A=[xdata(:,1).*xdata(:,2), (xdata(:,1)).^2];
x=A\ydata,

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by