ArrayValued intergral and control
3 ビュー (過去 30 日間)
表示 古いコメント
Hi, I have a complicated integral I need to calculate. Part of the integral will be calculated with the parameter ArrayValued. My function is $\int_0^inf l(x+t) dt$ where x will take values [61,70] and function l(x) can take parameter from 61-106. My program so far looks like below, because the result is higher than expected - how can I verify the calculations is done correctly. Hence, how can I check if the integral is calculated for age up till 106?
f_AD=@(t)f_lx(age); integral(f_AD,age,106,'ArrayValued',1)
function res=f_lx(age) param_1938 = [0.00005/1000,0.197642212387667/100000,1.23947876070978/10]; param_1945 = [4.63638421052291/1000,0.0534640767171731/100000,1.37338003232635/10]; param_1955 = [4.67255690389772/1000, 0.0192034319814117/100000, 1.47616811690684/10]; mu_1938=@(x) f_mu(x,param_1938); mu_1945=@(x) f_mu(x,param_1945); mu_1955=@(x) f_mu(x,param_1955); if age>=61 && age<=69 res = exp(-integral(mu_1955,0,age)); %(age 61-69) elseif age>69 && age<=76 res = exp(-integral(mu_1945,0,age)); %(age 70-76) else res = exp(-integral(mu_1938,0,age)); %(age 77-106) end end
function res=f_mu(x,param) a=param(1); b=param(2); c=param(3); res = zeros(size(x)); ind = x>100; res(ind) = a+b*exp(c*100)+(x(ind)-100)*0.001; res(~ind) =a+b*exp(c*x(~ind)); end
回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!