用matlab拟合函数,将这两组数据给拟合,算出xy的关系式.这个数据应该是指数函数,谢x=[98 103 117 142 186 232 291 363 435 526 615 1114 1639 2161 2720 3250 3816 4288 4914 5445 5962 6423 6950 7404 7884 8326 8765 9185 9529 10259

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/28 15:21:53

用matlab拟合函数,将这两组数据给拟合,算出xy的关系式.这个数据应该是指数函数,谢x=[98 103 117 142 186 232 291 363 435 526 615 1114 1639 2161 2720 3250 3816 4288 4914 5445 5962 6423 6950 7404 7884 8326 8765 9185 9529 10259
用matlab拟合函数,将这两组数据给拟合,算出xy的关系式.这个数据应该是指数函数,谢
x=[98 103 117 142 186 232 291 363 435 526 615 1114 1639 2161 2720 3250 3816 4288 4914 5445 5962 6423 6950 7404 7884 8326 8765 9185 9529 10259 11087 11883 12612 13128 13644 15651 18337 19697 19823 21409 22783 23748 24659 25272 25476 28235 29239 33436 36964 39890 54312 58625 59597 60278 63175 63544 64136 64889 65214 65491];
y=[0.3 0.5 0.7 1 1.3 1.7 2.1 2.5 3 3.5 4 6.3 9 11.7 14.5 17.2 19.8 22.5 25.2 27.8 30.5 33.1 35.5 37.9 40.4 42.7 44.9 47.1 49.1 53 57.5 61.5 65.5 68.5 72.2 85.4 101.2 114 121 123 132 140 148 152 157 187 193 240 282 329 568 786 818 879 1127 1192 1245 1347 1401 1465];
谢谢qibbxxt的提供,但是我没有fittype这个函数,请问还有什么好办法吗?

用matlab拟合函数,将这两组数据给拟合,算出xy的关系式.这个数据应该是指数函数,谢x=[98 103 117 142 186 232 291 363 435 526 615 1114 1639 2161 2720 3250 3816 4288 4914 5445 5962 6423 6950 7404 7884 8326 8765 9185 9529 10259
function createFit(x,y)
%CREATEFIT Create plot of data sets and fits
% CREATEFIT(X,Y)
% Creates a plot,similar to the plot in the main Curve Fitting Tool,
% using the data that you provide as input.You can
% use this function with the same data you used with CFTOOL
% or with different data.You may want to edit the function to
% customize the code and this help message.
%
% Number of data sets:1
% Number of fits:1
% Data from data set "y vs.x":
% X = x:
% Y = y:
% Unweighted
% Auto-generated by MATLAB on 01-Dec-2010 17:24:25
if nargin==0
x=[98 103 117 142 186 232 291 363 435 526 615 1114 1639 2161 2720 3250 3816 4288 4914 5445 5962 6423 6950 7404 7884 8326 8765 9185 9529 10259 11087 11883 12612 13128 13644 15651 18337 19697 19823 21409 22783 23748 24659 25272 25476 28235 29239 33436 36964 39890 54312 58625 59597 60278 63175 63544 64136 64889 65214 65491];
y=[0.3 0.5 0.7 1 1.3 1.7 2.1 2.5 3 3.5 4 6.3 9 11.7 14.5 17.2 19.8 22.5 25.2 27.8 30.5 33.1 35.5 37.9 40.4 42.7 44.9 47.1 49.1 53 57.5 61.5 65.5 68.5 72.2 85.4 101.2 114 121 123 132 140 148 152 157 187 193 240 282 329 568 786 818 879 1127 1192 1245 1347 1401 1465];
end
% Set up figure to receive data sets and fits
f_ = clf;
figure(f_);
set(f_,'Units','Pixels','Position',[578 254 688 485]);
% Line handles and text for the legend.
legh_ = [];
legt_ = {};
% Limits of the x-axis.
xlim_ = [Inf -Inf];
% Axes for the plot.
ax_ = axes;
set(ax_,'Units','normalized','OuterPosition',[0 0 1 1]);
set(ax_,'Box','on');
axes(ax_);
hold on;
% --- Plot data that was originally in data set "y vs.x"
x = x(:);
y = y(:);
h_ = line(x,y,'Parent',ax_,'Color',[0.333333 0 0.666667],...
'LineStyle','none','LineWidth',1,...
'Marker','.','MarkerSize',12);
xlim_(1) = min(xlim_(1),min(x));
xlim_(2) = max(xlim_(2),max(x));
legh_(end+1) = h_;
legt_{end+1} = 'y vs.x';
% Nudge axis limits beyond data limits
if all(isfinite(xlim_))
xlim_ = xlim_ + [-1 1] * 0.01 * diff(xlim_);
set(ax_,'XLim',xlim_)
else
set(ax_,'XLim',[-555.93000000000006,66144.929999999993]);
end
% --- Create fit "fit 1"
ok_ = isfinite(x) & isfinite(y);
if all( ok_ )
warning( 'GenerateMFile:IgnoringNansAndInfs',...
'Ignoring NaNs and Infs in data.' );
end
st_ = [35.773947240380622 5.3684112100804791e-005 ];
ft_ = fittype('exp1');
% Fit this model using new data
cf_ = fit(x(ok_),y(ok_),ft_,'Startpoint',st_);
% Alternatively uncomment the following lines to use coefficients from the
% original fit.You can use this choice to plot the original fit against new
% data.
% cv_ = { 23.933534662859728,6.1528631198640689e-005};
% cf_ = cfit(ft_,cv_{:});
% Plot this fit
h_ = plot(cf_,'fit',0.95);
set(h_(1),'Color',[1 0 0],...
'LineStyle','-','LineWidth',2,...
'Marker','none','MarkerSize',6);
% Turn off legend created by plot method.
legend off;
% Store line handle and fit name for legend.
legh_(end+1) = h_(1);
legt_{end+1} = 'fit 1';
% --- Finished fitting and plotting data.Clean up.
hold off;
% Display legend
leginfo_ = {'Orientation','vertical','Location','NorthEast'};
h_ = legend(ax_,legh_,legt_,leginfo_{:});
set(h_,'Interpreter','none');
% Remove labels from x- and y-axes.
xlabel(ax_,'');
ylabel(ax_,'');

用matlab 对一组数据进行拟合后,怎么直接显示拟合函数的图像? matlab能不能对多组数据做出拟合函数 用matlab拟合函数,将这两组数据给拟合,算出xy的关系式.这个数据应该是指数函数,谢x=[98 103 117 142 186 232 291 363 435 526 615 1114 1639 2161 2720 3250 3816 4288 4914 5445 5962 6423 6950 7404 7884 8326 8765 9185 9529 10259 matlab 拟合一元非线性拟合 用什么函数? 关于matlab 数据拟合 ,没有经验公式,不知道是几次的函数,该如何拟合? 在做一组数据的拟合,感觉很像正弦函数,怎样用MATLAB去拟合呀 Matlab中如何拟合椭圆现有一组数据,要用椭圆拟合他们,并得到拟合后椭圆的相关数据信息Matlab中有直接可调用的函数吗?没有的话, 怎么用matlab拟合反比例函数 matlab拟合函数 matlab的函数拟合 matlab中的cftool拟合,sse多少算拟合成功呢?用cftool拟合之后得到数据是这个SSE:0.09816R-square:0.5597Adjusted R-square:0.524RMSE:0.05151拟合函数可以用么? 怎么用matlab进行数据拟合然后计算误差 在用matlab进行数值拟合时,在知道x,y两组数据后,怎样实现数据的拟合 除了用polyfit 函数外那自己编写程序怎样来实现拟合 求高手指导用matlab对函数进行非线性拟合求出参数,已知数据x,y;万分感谢 matlab 拟合后斜率有一组数据,请问用matlab如何求出拟合后直线的斜率啊 谢谢 用MATLAB拟合曲线并求函数x=[0 0.1 0.2 0.4 0.6 0.8 1]y=[7.53 7.04 6.2 4.8 3.57 3.03 2.54]数据如下,已知尽量拟合成y=7.53-Aln(1+bx)的形式,我用MATLAB,一拟合就拟合失败,有没有什么软件能拟合出来 数学建模的数据拟合命令把一串数据的曲线用matlab拟合出方程来,用哪个命令 已知我满足某个函数原型,然后根据一组数据用最小二乘拟合来求这个函数原型中的参数,MATLAB中用什么函数