Main Content

integrate

cfit 객체 적분

설명

예제

int = integrate(fun,x,x0)cfit 객체 fun을 벡터 x로 지정된 점에서(x0부터 시작) 적분하여 결과를 int로 반환합니다.

예제

모두 축소

기준 정현파 신호를 만듭니다.

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

Figure contains 2 axes objects. Axes object 1 with xlabel x, ylabel y contains 2 objects of type line. One or more of the lines displays its values using only markers These objects represent data, fitted curve. Axes object 2 contains an object of type line. This object represents integral.

cfit plot 메서드를 사용하여 적분을 계산하고 직접 플로팅할 수도 있습니다.

figure
plot(fit1,xdata,ydata,{'fit','integral'})

Figure contains 2 axes objects. Axes object 1 with xlabel x, ylabel y contains 2 objects of type line. One or more of the lines displays its values using only markers These objects represent data, fitted curve. Axes object 2 with xlabel x contains an object of type line. This object represents integral from 0 to x.

그러나 plot 메서드는 적분에 대한 데이터를 반환하지 않습니다.

입력 인수

모두 축소

적분할 함수로, cfit 객체로 지정됩니다.

함수를 적분할 위치가 되는 점으로, 벡터로 지정됩니다.

적분의 첫 번째 점으로, 스칼라로 지정됩니다.

출력 인수

모두 축소

적분 결과로, x와 동일한 크기의 벡터로 반환됩니다.

버전 내역

R2006a 이전에 개발됨

참고 항목

| |