Azzera filtri
Azzera filtri

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 visualizzazioni (ultimi 30 giorni)
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)

Risposta accettata

Star Strider
Star Strider il 17 Ago 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)

Più risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by