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 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
khushi
am 17 Aug. 2015
Kommentiert: Star Strider
am 17 Aug. 2015
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 Kommentare
Akzeptierte Antwort
Star Strider
am 17 Aug. 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Conversion Between Symbolic and Numeric finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!