Definite integration in matlab with the limits changing ?

1 Ansicht (letzte 30 Tage)
P K
P K am 22 Jan. 2019
Kommentiert: Narendra Singh am 2 Jun. 2021
Hello @all -how can i achieve this:-
%Integrate the function with changing limit
%limit of intigration
lowerlimit=0, upperlimit=z;
% Please note upperlimit z is a array & z varies from 0 to some positive value,let say 5.
%function
f=(-1.99)/(1.99-2*exp(-0.01*u)-1.98*exp(-2*u)); % u is a dummy variable
Thank you in advance.

Akzeptierte Antwort

Star Strider
Star Strider am 22 Jan. 2019
Try this:
f = @(u) (-1.99)./(1.99-2*exp(-0.01*u)-1.98*exp(-2*u)); % u is a dummy variable
z = 0 : 5;
for k1 = 1:numel(z)
intf(k1) = integral(f, 0, z(k1));
end
You could also use the arrayfun function. The loop is much faster than arrayfun.
Experiment to get the result you want.
  3 Kommentare
Star Strider
Star Strider am 22 Jan. 2019
As always, my pleasure!
Narendra Singh
Narendra Singh am 2 Jun. 2021
hi Star
can you please help me to write this equation in

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by