%% 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.

[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)

% Copyright 2015 The MathWorks, Inc.