I ask for the numerical value and it gives me the expression

[EDIT: 20110615 12:27 CDT - reformat - WDR]
function y = Eg(t)
syms s;
%constantes
a=14;
b=15;
c=25;
L=c-b;
r=c;
phi=15;
V=7*7*28;
ro=1000;
RHi=100;
RHb=50;
dRH = RHb-RHi;
nus=0.3;
D=1;
M=8.3*10^(-6);
k=1.7;
Es=200000;
nuc=0.2;
lambda=0.3;
tp=1;
nu = k*(1-exp(-lambda*tp));
%------------------------
D1 = s*Epssa(s)-(s+lambda)*Epssa(s+lambda)/exp(lambda*tp);
Egs = (1/k)*(a-b)*(a+b)*(Es/s)*D1*s*(b^2*(nuc-1)-c^2*(nuc+1))/(4*b^2*(s*Epsf(s)-(s+lambda)*Epsf(s+lambda))+(b-c)*(b+c)*D1*((a^2*(nus+1)-b^2*(nus-1))));
y = ilaplace(Egs, s, t);
when I put E(2), it gives me :
ans =
- (12272724991839681694836231076749009375*gamma(3/10)*ilaplace(1/(s^(3/10)*((6003760639686170723358965455476297*gamma(3/10))/(28035470584169798842553923304161280*s^(3/10)) - (22862411300260886193*gamma(3/10))/(124502499794986393600*s^(13/10)) + 454730688161014190625/(9223372036854775808*s) - (113177415720074643*15^(1/2)*(-375*s)^(3/2))/(368934881474191032320*(-s)^(5/2)) + (26947003742874915*15^(1/2)*(-375*s)^(3/2))/(295147905179352825856*(-s)^(3/2)*s^(3/2)) - (16168202245724949*10^(1/2)*(-375*s)^(3/2))/(295147905179352825856*(-s)^(3/2)*s^(3/2)*exp(10*s^(1/2))) - (33609745164258450522786035802189*15^(1/2)*(-s)^(1/2)*erf(5*s^(1/4)*i)*(-375*s)^(3/2)*i)/(207691874341393105141219853168803840*s^(13/4)*exp(25*s^(1/2))) + (33609745164258450522786035802189*15^(1/2)*(-s)^(1/2)*erf(5*s^(1/4)*i)*(-375*s)^(3/2)*i)/(2076918743413931051412198531688038400*s^(15/4)*exp(25*s^(1/2))) + (33609745164258450522786035802189*15^(1/2)*(-s)^(1/2)*erf(15^(1/2)*s^(1/4)*i)*(-375*s)^(3/2)*i)/(207691874341393105141219853168803840*s^(13/4)*exp(25*s^(1/2))) - (33609745164258450522786035802189*15^(1/2)*(-s)^(1/2)*erf(15^(1/2)*s^(1/4)*i)*(-375*s)^(3/2)*i)/(2076918743413931051412198531688038400*s^(15/4)*exp(25*s^(1/2))))), s, 2))/2978768749568041127021354351067136 + (9346944469561546516875*gamma(3/10)*ilaplace(1/(s^(13/10)*((6003760639686170723358965455476297*gamma(3/10))/(28035470584169798842553923304161280*s^(3/10)) - (22862411300260886193*gamma(3/10))/(124502499794986393600*s^(13/10)) + 454730688161014190625/(9223372036854775808*s) - (113177415720074643*15^(1/2)*(-375*s)^(3/2))/(368934881474191032320*(-s)^(5/2)) + (26947003742874915*15^(1/2)*(-375*s)^(3/2))/(295147905179352825856*(-s)^(3/2)*s^(3/2)) - (16168202245724949*10^(1/2)*(-375*s)^(3/2))/(295147905179352825856*(-s)^(3/2)*s^(3/2)*exp(10*s^(1/2))) - (33609745164258450522786035802189*15^(1/2)*(-s)^(1/2)*erf(5*s^(1/4)*i)*(-375*s)^(3/2)*i)/(207691874341393105141219853168803840*s^(13/4)*exp(25*s^(1/2))) + (33609745164258450522786035802189*15^(1/2)*(-s)^(1/2)*erf(5*s^(1/4)*i)*(-375*s)^(3/2)*i)/(2076918743413931051412198531688038400*s^(15/4)*exp(25*s^(1/2))) + (33609745164258450522786035802189*15^(1/2)*(-s)^(1/2)*erf(15^(1/2)*s^(1/4)*i)*(-375*s)^(3/2)*i)/(207691874341393105141219853168803840*s^(13/4)*exp(25*s^(1/2))) - (33609745164258450522786035802189*15^(1/2)*(-s)^(1/2)*erf(15^(1/2)*s^(1/4)*i)*(-375*s)^(3/2)*i)/(2076918743413931051412198531688038400*s^(15/4)*exp(25*s^(1/2))))), s, 2))/2645678120643460864
:o

Réponses (3)

I assume "E(2)" is a typo and you mean "Eg(2)". Perhaps this works:
Value = Eg(2);
eval(Value)
[EDIT: 20110616 10:05 CDT - reformat - WDR]
Actually It gives me
??? Error using ==> evalin
Undefined function or variable 's'.
Error in ==> sym.eval at 15
s = evalin('caller',vectorize(map2mat(char(x))));
------------------------
I guess the problem is from a function called Erfi that I have download from Mathworks and It doesn't work with symbols. That's why I can't the "ilaplace". Here is the whole program:
%-------------------------------------
function ans=erfi(x)
% %erfi(x). The Imaginary error function, as it is defined in Mathematica
% %erfi(z)==erf(iz)/i (z could be complex) using
% %the incomplete gamma function in matlab: gammainc
% %Using "@": erfi = @(x) real(-sqrt(-1).*sign(x).*gammainc(-x.^2,1/2))
% %Note: limit(x->0) erfi(x)/x -> 2/sqrt(pi)
%
% %Example 1:
% x=linspace(0.001,6,100);
% y=exp(-x.^2).*erfi(x)./2./x;
% figure(1), clf;plot(x,y*sqrt(pi))
%
% %Example 2:
% [x,y]=meshgrid(linspace(-3,3,180),linspace(-3,3,180));
% z=x+i*y;
% figure(1), clf;contourf(x,y,log(erfi(z)))
% axis equal;axis off
xc=5.7;%cut for asymptotic approximation (when x is real)
ans=~isreal(x).*(-(sqrt(-x.^2)./(x+isreal(x))).*gammainc(-x.^2,1/2))+...
isreal(x).*real(-sqrt(-1).*sign(x).*((x<xc).*gammainc(-x.^2,1/2))+...
(x>=xc).*exp(x.^2)./x/sqrt(pi));
%------------------------------------------------------
%graphe.m
k=1.7;
lambda=0.3;
tp=1;
nu = k*(1-exp(-lambda*tp));
Ec = nu*floor(Eg(t-tp));
%graphe
ezplot(Ec,[1 35])
%----------------------------------------
function ans = Epssa(s)
syms t;
Epsa = -16.7*10^(-6)*t^(0.3);
ans = laplace(Epsa);
%-----------------
function y = Epsf(t)
%constantes
a = 14;
b=15;
c=25;
L=c-b;
r=c;
phi=15;
V=7*7*28;
ro=1000;
RHi=100;
RHb=50;
dRH = RHb-RHi;
nus=0.3;
D=1;
M=8.3*10^(-6);
k=1.7;
Es=200000;
nuc=0.2;
lambda=0.3;
tp=1;
nu = k*(1-exp(-lambda*tp));
%-------------
%RH(c,s)
%Bi
syms s;
B1 = b*sqrt(s)/sqrt(D);
B2 = c*sqrt(s)/sqrt(D);
B3 = r*sqrt(s)/sqrt(D);
B4 = -b*exp(B2)*(b-r)*(b+r)*RHi*sqrt(s)-3*c*exp(B2)*(b-r)*(b+r)*sqrt(s);
B5 = D^(7/4)*sqrt(pi)*dRH*(3*sqrt(D)-2*b*sqrt(s))*sqrt(-s/D)*(erfi(sqrt(b)*(s/D)^(1/4))-erfi(sqrt(r)*(s/D)^(1/4)))/(b^(3/2)*s^(9/4));
RH= sqrt(D)*exp(-c*sqrt(s)/sqrt(D))*(-b*c*s/D)^(3/2)*((D)^(3/2)*sqrt(-b*c*s/D)*(-6*c^(3/2)*(sqrt(6*D)*exp(B1)-exp(B3)*sqrt(D*r))*dRH-B4)/(b^2*c^2*s^2)+B5)/(2*(3*c+b)*s^(3/2));
y = -1.1*M*((c^2-b^2)*RHi/(2*s)-RH);
%--------------------------------------------------
function y = Eg(t)
syms s;
%constantes
a=14;
b=15;
c=25;
L=c-b;
r=c;
phi=15;
V=7*7*28;
ro=1000;
RHi=100;
RHb=50;
dRH = RHb-RHi;
nus=0.3;
D=1;
M=8.3*10^(-6);
k=1.7;
Es=200000;
nuc=0.2;
lambda=0.3;
tp=1;
nu = k*(1-exp(-lambda*tp));
%------------------------
D1 = s*Epssa(s)-(s+lambda)*Epssa(s+lambda)/exp(lambda*tp);
Egs = (1/k)*(a-b)*(a+b)*(Es/s)*D1*s*(b^2*(nuc-1)-c^2*(nuc+1))/(4*b^2*(s*Epsf(s)-(s+lambda)*Epsf(s+lambda))+(b-c)*(b+c)*D1*((a^2*(nus+1)-b^2*(nus-1))))
y = ilaplace(Egs);
%-----------------------------------------
I really appreciate your help guys :)

Catégories

En savoir plus sur Mathematics dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by