0
Good evening. Could someone help me?
I need to create a Matlab function that solves integrals by "Composite Trapeze Rule".
I know how the "Trapeze Rule" works, but how to do the implementation in Matlab?
0
Good evening. Could someone help me?
I need to create a Matlab function that solves integrals by "Composite Trapeze Rule".
I know how the "Trapeze Rule" works, but how to do the implementation in Matlab?
1
Given that Matlab is a very versatile software for calculation with matrices and data analysis, most widely used algorithms for data analysis have a version built-in.
What you are wanting to implement is the function trapz.
But I encourage you to build your own version and compare the results (they should be equal or only with 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 mine experience, but maybe ñ is the best option for you) is to understand how the method is used if you calculate with pencil and paper. See what you can turn into for
loops and if
and else
statements and build your function with it.
Browser other questions tagged matlab
You are not signed in. Login or sign up in order to post.
How does the "trapeze rule" work? What have you tried so far? What is the difference of a conventional "trapeze rule" of the "composite trapeze rule"?
– Jefferson Quesado
@Jeffersonquesado Composite Trapeze Rule and error calculation: https://www.math.tecnico.ulisboa.pt/~calves/Courses/integra/capiii32.html
– José
@Does José serve Java/C/Python? I would even speak Bash, but Bash doesn’t get along very well with broken numbers... I definitely don’t know R or Matlab, and I don’t have much incentive to learn in my current situation
– Jefferson Quesado
@Jeffersonquesado there is with the comrade Student who was the one who asked. But I don’t think it fits.. I even know R or Matlab to answer, but it will take a while to formulate an answer and may not be the best algorithm. I don’t use these tools anymore.
– José