필터 지우기
필터 지우기

Regression with functions handles-Help please!

조회 수: 1 (최근 30일)
SB
SB 2012년 10월 26일
Say that
y = a1*f1(x)+ a2* f2(x) + ...+ an*fn(x)
where x and y are column vectors, f1(x),....,fn(x) are function handles at x. How would you solve for the coefficient matrix A using least squares regression?
Here's what I have so far:
function A= MyRegressor(x2,y2,fhs)
for i = 1:numel(fhs)
f = fhs{i}(x2(i));
end
A=f/y2(i)

답변 (1개)

Sean de Wolski
Sean de Wolski 2012년 10월 26일
doc lsqnonlin
Would probably be my first choice.
  댓글 수: 2
SB
SB 2012년 10월 26일
Thanks, I was trying to solve it using just a A=x\y format, however. Is there any way to edit my code to do that?
SB
SB 2012년 10월 26일
Also, I don't think i'm allowed to use that function.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by