Borrar filtros
Borrar filtros

Do you know how to solve an integral over a loop?

1 visualización (últimos 30 días)
Parham Babakhani Dehkordi
Parham Babakhani Dehkordi el 11 de Oct. de 2016
Respondida: Torsten el 11 de Oct. de 2016
Hi, I have a integral that I need to solve, the problem is that I have a loop, that is, for each value of r, Ihave one U, my inputs are:
r=[0 2.19 4.53 6.87 9.21 11.55 13.89 16.23 18.57 20.95 23.29 25.63 27.97 30.31 32.66 35.0 37.34 39.68 42.023 44.36 46.70 49.04 51.38];
U=[0 0 0 0.588 1.685 2.03 2.307 2.544 2.598 2.733 2.565 2.663 2.437 2.425 2.263 2.507 2.525 2.537 2.416 2.268 1.979 1.708 0.614];
Function is: F=2/(r^2) ∫U r dr
The bounds of integral are between 0 to 51.38 . Any help would be appreciated.
  1 comentario
Walter Roberson
Walter Roberson el 11 de Oct. de 2016
It does not make sense to integrate with respect to r if you have one U value for each r value.
It does not make sense to integrate with respect to a discrete variable.

Iniciar sesión para comentar.

Respuesta aceptada

Torsten
Torsten el 11 de Oct. de 2016
Ur=U.*r;
result=trapz(r,Ur);
gives you an approximation of
integral_{r=0}^{r=51.38} U*r dr.
Best wishes
Torsten.

Más respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by