ArrayValued intergral and control

3 ビュー (過去 30 日間)
Orongo 2018 年 11 月 6 日
再開済み: madhan ravi 2018 年 11 月 8 日

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?

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)
    res = exp(-integral(mu_1938,0,age)); %(age 77-106)
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));
  2 件のコメント
Orongo 2018 年 11 月 8 日
Walter that is so true. I have changed every step of the calculation, so the calculation is now done by the command
AD= @(x) (integral(@(t)(exp(-0.028559*t)*f_l(x+t)/f_l(x)),0,106,'ArrayValued',1));
A bit neater :) thanks for your input.


回答 (0 件)


Community Treasure Hunt

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

Start Hunting!

Translated by