problems with fitting curve from matrix data
이전 댓글 표시
Hey there, i have some problems to fitting a curve. Both matrix have two columns and the same length, but i get the error:
??? XDATA must be a matrix with one to two columns.
Error in ==> fit at 115 errstr = handleerr('curvefit:fit:xDataMustBeColumnVector', ...
Error in ==> Niederschlag_Trend at 127 [fitobject, R2] = fit(x,y, 'linearinterp');
What I need is the determination coefficient for the double mass curve, if there is any suggestion to solve it another way, i´m happy to hear it :)
%%Homogenitätstest
load(['niederschlag2_' num2str(NS.start_jahr) '-'num2str(NS.end_jahr)]);
load ref81-2010.mat;
testdata = MaxMatrix(:,2);
refdata = RefMat(:,2);
x=testdata(1);
y=refdata(1);
for i=2:length(testdata);
x(i)=x(i-1) + refdata(i);
y(i)=x(i-1) + testdata(i);
end
%%xi=[min(x),max(x)];
%%yi=[min(y),max(y)];
figure(3)
clf
plot(x,y,'*k','LineWidth',2, 'Color','black')
hold on
*[fitobject, R2] = fit(x,y, 'linearinterp');*
%%plot(xi,yi,'r','LineWidth',2,'Color','red');
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!