MATLAB Answers

Integration of a function with variable parameter

3 views (last 30 days)
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 Comment
John D'Errico
John D'Errico on 29 May 2021
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.

Sign in to comment.

Accepted Answer

Alan Stevens
Alan Stevens on 29 May 2021
Do you mean something like this?
H = @(tau, lam, tt) lam./exp(tt-tau);
lambda = rand(1,step+1);
tau = 1;
y = H(tau,lambda,t);
I = cumtrapz(y)*h;

More Answers (0)

Community Treasure Hunt

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

Start Hunting!