How to integrate this function numerically?

조회 수: 2 (최근 30일)
Mohamed Nedal
Mohamed Nedal 2019년 12월 14일
댓글: Mohamed Nedal 2019년 12월 15일
Hello everyone,
I'm stuck at this equation and I want to integrate it numerically
where
and r = 695510, a = -0.0021, b = 1.34, Wo = 438.1
I need to integrate the first equation numerically to get V as a function of R
Numerical integration from R = 10, where it is assumed V = U, to 215 should give V(R).
I appreciate your help.
Thank you,
  댓글 수: 2
Walter Roberson
Walter Roberson 2019년 12월 14일
Is e the base of the natural logarithms? And is it acting as a constant multiplier or is e being raised to the part after it?
Mohamed Nedal
Mohamed Nedal 2019년 12월 14일
Yes that's right, it's the base of the natural logarithm and it's being raised to the part after it.

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

채택된 답변

Chuguang Pan
Chuguang Pan 2019년 12월 14일
You can use Euler formula. V(n+1)=V(n)+h*f(R,V(n)), which f(R,V) is the right side of differential equation.
But you need to know the initial value V(10).
r=695510;a=-0.0021;b=1.34;Wo=438.1;
h=0.1;%Integral step size, you can change this value
N=100;%It means that you want to integral from 10 to 10+h*N
V=zeros(1,N+1);%Initialization V array
V(1)=?;%Need to know the initial value V(10)
for n=1:N
R=10+(n-1)*h;
W=Wo*sqrt(1-exp(1)*(2.8-R)/8.1);
V(n+1)=V(n)+h*r*a*R^(-b)*(1-W/V(n));
end
X=10+(0:N)*h;
Y=V;
plot(X,Y);
  댓글 수: 12
Chuguang Pan
Chuguang Pan 2019년 12월 15일
result_V=zeros(1,length(Vtest));% save last V for every Vtest
result_t=zeros(1,length(Vtest));% save last t for every Vtest
for i=1:length(Vtest) %for every Vtest
V=zeros(1,N+1);
V(1)=Vtest(i);
%do the computing
result_V=V(end); %using end to index last value of array V
result_t=t(end); %using end to index last value of array t
end
Mohamed Nedal
Mohamed Nedal 2019년 12월 15일
Thank you so much

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by