www.gusucode.com > curvefit 案例源码程序 matlab代码 > curvefit/ReshapeRowstoColumnsforCurveFittingExample.m
%% Reshape Rows to Columns for Curve Fitting % The following commands load the example |titanium| data in which |x| and % |y| are row vectors. Attempting to use rows as inputs to the |fit| function % produces an error. The |prepareCurveData| function reshapes |x| and |y| % to columns for use with the |fit| function. % Copyright 2015 The MathWorks, Inc. %% [x,y] = titanium(); [x,y] = prepareCurveData(x,y); %% % Create and plot a fit using the reshaped data. f = fit(x,y,'smoothingspline'); plot(f,x,y)