define a function in terms of an integral with variable limits

3 vues (au cours des 30 derniers jours)
Barbara Margolius
Barbara Margolius le 30 Jan 2023
I have defined a function of two variables, say f(u,t), and would like to define a function g(t)=@(t)integral(f(u,t),u,[t-1,t]). How would I do this?

Réponse acceptée

Torsten
Torsten le 31 Jan 2023
Modifié(e) : Torsten le 31 Jan 2023
f1=@(t)3+2*cos(2*pi*t);
f2=@(t)4-3*sin(2*pi*t);
ff=@(t)-f1(t)-f2(t);
gg=@(u,t)integral(ff,u,t);
ww = @(u,t)f1(t).*exp(gg(u,t));
www=@(t)integral(@(u)ww(u,t),t-1,t,'ArrayValued',1);
www(2)
ans = 0.5163

Plus de réponses (0)

Catégories

En savoir plus sur External Language Interfaces dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by