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 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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)
0 commentaires
Réponse acceptée
Star Strider
le 17 Août 2015
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)
2 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Conversion Between Symbolic and Numeric dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!