problems with fitting curve from matrix data
Show older comments
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');
Accepted Answer
More Answers (0)
Categories
Find more on Get Started with Curve Fitting Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!