Integration of a function with variable parameter

조회 수: 10 (최근 30일)
Md Nurul Anwar
Md Nurul Anwar 2021년 5월 29일
댓글: Md Nurul Anwar 2021년 5월 29일
I have a function say f(tau)=lambda(tau) /exp(t-tau) where lambda is not an explicit function of tau. lambda has numeric values that are created inside a for loop and within each loop i need the integral value of f(tau) that considers all the value of lambda current and past. how do I do it? Please anyone can help?
I have attached an example code so it's easies to follow.
  댓글 수: 1
John D'Errico
John D'Errico 2021년 5월 29일
Please don't ask your question every two hours until you get an answer. You have now gotten answers on BOTH of these identical questions.

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

채택된 답변

Alan Stevens
Alan Stevens 2021년 5월 29일
Do you mean something like this?
H = @(tau, lam, tt) lam./exp(tt-tau);
T=50;
step=1000;
h=T/step;
t=0:h:T;
lambda = rand(1,step+1);
tau = 1;
y = H(tau,lambda,t);
I = cumtrapz(y)*h;
subplot(2,1,1)
plot(t,y),grid
subplot(2,1,2)
plot(t,I),grid

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by