MATLAB Answers

How to take integral with for loop?

2 views (last 30 days)
Arya Akhtar
Arya Akhtar on 24 May 2021
Commented: Arya Akhtar on 25 May 2021
I would like to integrate my function with for loop.
for l = 1: length(x)-1
final(l) = (upper(i+1)-upper(i)).*(w(2)-w(1)) ;
where x is my function and l is my time. i cannot have desired output. how can i do that?

Accepted Answer

Alan Stevens
Alan Stevens on 25 May 2021
Add the command
I = sum(final);
after the loop.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!