please help me in this program something wrong in integration
Mostrar comentarios más antiguos
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 comentario
Jan
el 17 de Jul. de 2012
"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.
Respuestas (1)
Andrei Bobrov
el 17 de Jul. de 2012
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')
Categorías
Más información sobre Mathematics en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!