필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
Parham Babakhani Dehkordi
Parham Babakhani Dehkordi 2016년 10월 11일
답변: Torsten 2016년 10월 11일
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
Walter Roberson
Walter Roberson 2016년 10월 11일
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.

댓글을 달려면 로그인하십시오.

채택된 답변

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by