How to write an integral using 'cumsum'?

6 ビュー (過去 30 日間)
NEELABJA CHATTERJEE
NEELABJA CHATTERJEE 2018 年 9 月 23 日
I want to write this discretized integral in MatLab using 'cumsum'.
I tried the following (where i0 = find(x==0))
Pp=Dx*cumsum(u(i0:end));
Pm=-Dx*[fliplr(cumsum(fliplr(u(1:i0-1)))) 0];
P=[Pm Pp];
Pk=0.5*(P(1:end-1)+P(2:end));
to compute $ \int_{-1}^{1} u(y,t) dy$ (for a fixed, to be evolved later time level; the integral from -1 to 1 of the function u(x,t)dx.) Now I want to compute [integral from 0 to x of the function u(y,t)dy] - [integral from 0 to 1 integral from 0 to y of the function u(z,t)dzdy] ~ I have attached the discretized form here with.
Any kind of help regarding this coding would be much appreciated.

回答 (0 件)

カテゴリ

Help Center および File ExchangeNumerical Integration and Differentiation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by