필터 지우기
필터 지우기

Numerical integration using cumtrapz

조회 수: 6 (최근 30일)
Somnath Kale
Somnath Kale 2021년 2월 17일
댓글: Star Strider 2021년 2월 19일
how to add upper and lower limits in cumtrpz function?

채택된 답변

Star Strider
Star Strider 2021년 2월 17일
The cumtrapz function integrates a vector, and ideally, the dependent variable vector with respect to the independent variable vector.
The limits of the independent variable vector are the limits of the integration, so for example:
x = 0:42;
y = randn(size(x));
Int_y_dx = cumtrapz(x, y);
figure
yyaxis left
plot(x, y)
ylabel('$y(x)$', 'Interpreter','latex')
yyaxis right
plot(x, Int_y_dx)
ylabel(sprintf('$\\int_{%d}^{%d}y(x)\\ dx$',min(x),max(x)), 'Interpreter','latex', 'FontSize',14)
grid
xlim([min(x) max(x)])
.
  댓글 수: 2
Somnath Kale
Somnath Kale 2021년 2월 19일
Thank you!! @Star Strider
Star Strider
Star Strider 2021년 2월 19일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 NaNs에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by