integrate
对 cfit
对象求积分
说明
示例
使用 integrate
函数求拟合的积分
创建一个基线正弦信号。
xdata = (0:.1:2*pi)'; y0 = sin(xdata);
将响应相关的高斯噪声添加到该信号中。
noise = 2*y0.*randn(size(y0)); ydata = y0 + noise;
用自定义正弦模型对含噪数据进行拟合。
f = fittype('a*sin(b*x)'); fit1 = fit(xdata,ydata,f,'StartPoint',[1 1]);
求预测变量处拟合的积分。
int = integrate(fit1,xdata,0);
绘制数据、拟合和积分。
subplot(2,1,1) plot(fit1,xdata,ydata) % cfit plot method subplot(2,1,2) plot(xdata,int,'m') % double plot method grid on legend('integral')
您也可以使用 cfit
plot
方法直接计算积分并对其绘图:
figure plot(fit1,xdata,ydata,{'fit','integral'})
然而,plot
方法不返回积分数据。
输入参数
fun
— cfit
函数
cfit
求积分的函数,指定为 cfit
对象。
x
— 积分点
数值向量
函数的积分点,指定为数值向量。
x0
— 积分的下界
数值标量
积分的下界,指定为数值标量。
版本历史记录
在 R2006a 之前推出
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)