我使用MATLAB曲线拟合工具进行样条平滑拟合并从中创建函数。如何访问Y拟合值以便将其输出到文件中?似乎我只看到x值,以及来自fitresult的所有coefs。这是matlab代码。谢谢!
function [fitresult, gof] = createFit(Freq, AmplNew)
%CREATEFIT(FREQ,AMPLNEW)
% Create a fit.
%
% Data for 'untitled fit 1' fit:
% X Input : Freq
% Y Output: AmplNew
% Output:
% fitresult : a fit object representing the fit.
% gof : structure with goodness-of fit info.
%
%% Fit: 'untitled fit 1'.
[xData, yData] = prepareCurveData( Freq, AmplNew );
% Set up fittype and options.
ft = fittype( 'smoothingspline' );
opts = fitoptions( 'Method', 'SmoothingSpline' );
opts.SmoothingParam = 0.998;
% Fit model to data.
[fitresult, gof] = fit( xData, yData, ft, opts );