please help me in this program something wrong in integration

n= input('enter the value of a ');
g= input('enter the value of index ');
z=n-1;
e=exp(1);
syms t;
f= (e^(-t)).*(t^(z));
y=int(f,t,0,inf)
y1=int(f,t,0,g)
y2=y-y1
b= input ('enter the value of b ');
x=g:200;
l = pdf('gam',x,n,b);
plot(x,l,'green')
hold on;
p= ((x.^z).* (e.^(-(x/b))))/((y2*(b.^n))*y1);
plot(x,p,'blue')
there is something wrong with integral y1,any help will be welcomed,

댓글 수: 1

"Something is wrong" is not a helpful description of the problem. It is better to post either the complete error message or explain the differences between the results and your expectations.
Please follow the "Aubout MATLAB Answers" link to learn how to format code in the forum.

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

답변 (1개)

Andrei Bobrov
Andrei Bobrov 2012년 7월 17일
p = input ('enter the parametrs p in form: [n, b, g], here n < b && n > 0 && g < 200 => ');
f = @(t)exp(-t).*t.^(p(1) - 1);
A = cellfun(@(x)quadgk(f,x{:}),{{0,p(3)},{p(3) inf}});
x=p(3):200;
l = pdf('gam',x,p(1),p(2));
p1 = x.^(p(1)-1).* exp(-x/p(2) ) / (A(2)*p(2).^p(1)*A(1));
plot(x,l,'green')
hold on;
plot(x,p1,'blue')

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

질문:

2012년 7월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by