Numerical Integration of function with many parameters

조회 수: 7 (최근 30일)
JACINTA ONWUKA
JACINTA ONWUKA 2019년 6월 3일
댓글: Star Strider 2019년 6월 4일
Hi, I've been trying to do this code on matlab but keep getting error.
I want to integrate this function fun= @(t,Mycp,L,r)Mycp*L*exp(-r*t) with n= integral(@(t)fun(t,Mycp,L,r),0,100).
The interval t=[0 100]
The parameters are Mycp=[0 10], L=1,r=0.03,
Please help!

채택된 답변

Star Strider
Star Strider 2019년 6월 3일
Use the 'ArrayValued' (link) name-value pair:
Mycp = [0 10];
L = 1;
r = 0.03;
fun = @(t,Mycp,L,r)Mycp*L*exp(-r*t);
n = integral(@(t)fun(t,Mycp,L,r),0,100, 'ArrayValued',1)
producing:
n =
0 316.737643877379
  댓글 수: 5
Star Strider
Star Strider 2019년 6월 4일
As always, my pleasure!

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

추가 답변 (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