Use trapezoidal method to find the deflection at each measurement point.

2 views (last 30 days)
Hi,
I have the following 21x2 matrix
I need to use loops and trapezoidal method to find the deflection at each measurement point. By using the trapz command I can find the overall result but I need guidance with how to find the deflection at each measurement point.
  1 Comment
Sean Flanagan
Sean Flanagan on 1 Oct 2022
cumtrapz gives me each answer for [f(x0)...f(x20]. Is there a way to write the code to give [f(x0)+f(x1)] = ans, [f(x0)+f(x1)+f(x2)] = ans, [f(x0)+f(x1)+f(x2)+f(x3)] = ans .....[f(x0)+f(x1)....+f(x19)+f(x20)] = ans, using for loops?

Sign in to comment.

Answers (1)

James Tursa
James Tursa on 30 Sep 2022
Sounds like you want the cumtrapz( ) function. If the assignment requires you to use loops, just code up the formula found in the trapz( ) doc:
  4 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!