trapeze rule in matlab!

0

Good evening. Could someone help me?

I need to create a function in matlab that solves integrals by the "Compound Trapezoid Rule".

I know how the "Trapeze Rule" works, but how to do the implementation in matlab?

    
asked by anonymous 08.11.2017 / 01:10

1 answer

1

Since Matlab is a very versatile software for calculation with arrays and data analysis, most widely used algorithms for date analysis rely on a built-in version.

What you're trying to implement is the trapz function.

But I encourage you to build your own version and compare the results (they should be the same or with only a small difference). Your version will most likely be worse and slower, but it's a great exercise to learn how to program better.

An idea to follow (based on my experience, but perhaps not the best one for you) is to understand how the method is used if you calculate with pencil and paper. See what you can transform into for loops and if and else statements and build your function with that.

    
08.11.2017 / 18:22