How to integrate integral(i​ntegral(co​s(t),-10,t​) ,t1,t2)

1 Ansicht (letzte 30 Tage)
Ole
Ole am 23 Mär. 2016
Kommentiert: Ole am 23 Mär. 2016
How to integrate numerically Z(t1,t2) ? My function is more complicated than cos but is analytical.
integral(integral(cos(t),-10,t) ,t1,t2)
F = @(t) cos(t);
A = @(t) -integral(F,-10,t)
Z = @(t1,t2) - integral(A,t1,t2)
Z(0,1)

Akzeptierte Antwort

Justin Griffiths
Justin Griffiths am 23 Mär. 2016
The intermediate integration is numerical in nature so the operation needs to be vectorized. Unfortunately the integral function does not handle vectors for integral limits. Try the following
F = @(t) cos(t);
A = @(t) arrayfun(@(s)-integral(F,-10,s),s);
Z = @(t1,t2) -integral(A,t1,t2);

Weitere Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by