フィルターのクリア

Numerical Integration problem

1 回表示 (過去 30 日間)
Keith
Keith 2011 年 11 月 30 日
Hi can anyone advise: I am trying to integrate numerically an equation from z_star_=25 down to d=4. However, the solution derives NaN at 6 down to 4.... The code/equation:
d=4;
z_star=25;
u_star_z_star=0.5;
k=0.4;
F = @(x)(((sin((pi()/2)*((x-d)/(z_star-d))).^1.28).^0.333)./(x-d))*(u_star_z_star/k);
%%%--- TABULATING SOLUTION BETWEEN LIMITS --- %%%
A=zeros(85,2);
a=1;
b=1;
z=z_star
for z=z:-0.25:d;
Q(a) = quadv(F,d,z);
D(b)=z
a=a+1;
b=b+1
end
for i=1:length(A);
A(i,1)=D(i);
A(i,2)=Q(i);
end

回答 (1 件)

Andrei Bobrov
Andrei Bobrov 2011 年 11 月 30 日
use quadgk
for quadgk(F,d,z), if z = 4 then F(4) = NaN, division by zero.

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by