채택된 답변

Star Strider
Star Strider 2021년 2월 17일

0 개 추천

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

카테고리

도움말 센터 및 File Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

질문:

2021년 2월 17일

댓글:

2021년 2월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by