Nested integral and how to plot

1 回表示 (過去 30 日間)
Orongo
Orongo 2017 年 10 月 15 日
Hi, I have this exercise to calculate D_x that is defined as following:
So far my program looks like this..
main.m:
% main.m
delta = 0.028559;
x=61;
mu_x=@(t) mu(t);
lx = @(x) exp(-integral(@(t) mu_x(t),0,x));
Dx = integral(@(t) exp(-delta*t)*lx(x+t)/lx(x), 0, inf,'ArrayValued', true);
mu.m
function res=mu(x)
a=0.006782872;
b=5.44781E-08;
c=0.137849468;
res = zeros(size(x));
ind = x>97;
res(~ind) = a+b*exp(c*x(~ind));
res(ind) = a+b*exp(c*97)+(x(ind)-97)*0.001;
end
There are 2 main questions I struggle with this one. 1) Is the program correct? I get a higher value then expected and I don't understand how Matlab assign integrals. 2) How to I plot the results? Say x=61:101 for mu_x, l(x) and D_x?

回答 (0 件)

カテゴリ

Help Center および File ExchangeNumerical Integration and Differentiation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by