필터 지우기
필터 지우기

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개)

카테고리

Help CenterFile Exchange에서 Conversion Between Symbolic and Numeric에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by