error of conversion from sym to double is coming and when i used double then double can't convert to double array..plz help

2 次查看(过去 30 天)
clc;
clear all;
c=1;
g=1:1:5;
lambda=2;
b=2;
syms y
P=((0.5*lambda)/((b^(lambda*c))*gamma(c)));
Q=(exp(-(y/b)^lambda))*(exp(-g.*y));
R=y^(lambda*c-1);
T= P*Q*R;
int(T,y,0,100)
plot(g,T)

采纳的回答

Star Strider
Star Strider 2015-8-17
Your ‘T’ assignment contains ‘y’ as a symbolic variable. Since you’re calculating its integral, I assume you want to plot the integral.
See if this does what you want:
c=1;
g=1:1:5;
lambda=2;
b=2;
syms y
P=((0.5*lambda)/((b^(lambda*c))*gamma(c)));
Q=(exp(-(y/b)^lambda))*(exp(-g.*y));
R=y^(lambda*c-1);
T= P*Q*R;
IntT = vpa(int(T,y,0,100));
plot(g,IntT)
Another possibility:
Tfcn = matlabFunction(T);
IntT = integral(Tfcn,0,100, 'ArrayValued',1);
plot(g,IntT)

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by