필터 지우기
필터 지우기

weighted fit

조회 수: 56 (최근 30일)
Ellen
Ellen 2011년 9월 16일
편집: Jeremy 2023년 6월 16일
Hello,
I want to fit some data with a weightfactor, which i have already made. So I have a matrix of 30 by 53 with data, and a matrix with a weightfactor for each datapoint. I want to fit it for each line seperately. I have been looking in the MATLAb help, bet I can't figure out how to do this myself
Does anyone know how to do this?
Thanks! Ellen

채택된 답변

Grzegorz Knor
Grzegorz Knor 2011년 9월 16일
Look at example code:
% generate data
x = 0:.1:10;
y = x.*x + randn(size(x));
w = linspace(.5, .7,length(x));
x = x(:);
y = y(:);
w = w(:);
%plot data
plot(x,y,'.');
%fit
ft = fittype('poly2');
cf = fit(x,y,ft,'Weight',w);
% Plot fit
hold on
plot(cf,'fit',0.95);
  댓글 수: 1
Erin Evans
Erin Evans 2023년 6월 6일
Is there a way to incorporate the weighting of robustfit() in this code?

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

추가 답변 (1개)

Jeremy
Jeremy 2023년 6월 16일
편집: Jeremy 2023년 6월 16일
Oh, I get the same tiny fishing issue and thanks for reply.

카테고리

Help CenterFile Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by