Definite integration in matlab with the limits changing ?

조회 수: 1 (최근 30일)
P K
P K 2019년 1월 22일
댓글: Narendra Singh 2021년 6월 2일
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.

채택된 답변

Star Strider
Star Strider 2019년 1월 22일
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
Star Strider
Star Strider 2019년 1월 22일
As always, my pleasure!
Narendra Singh
Narendra Singh 2021년 6월 2일
hi Star
can you please help me to write this equation in

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by