I am trying to get an infinite sum using symsum, but when I trying to convert to double I am getting error

2 visualizaciones (últimos 30 días)
%if true
%%%%
clear all
E=0.01;
% t= [0.025 0.05 0.1 0.2 0.3 0.4 1]';
t=[ 0.05];
y=0:0.1:1;
y=y';
syms n
p=(1/(4*pi*pi*E))^0.5;
if floor(p)==p
i=1;
while i<(length(t)+1)
j=1;
while j<(length(y)+1)
S1 = symsum( (sin( n*pi*y(j))/n)*exp(-0.5*t(i)/E)*( cosh(0.5*((1-4*n*n*pi*pi*E)^0.5)*t(i)/E)+ ((1/(1-4*n*n*pi*pi*E))^0.5) *sinh(0.5*((1-4*n*n*pi*pi*E)^0.5)*t(i)/E)) , n, 1, p-1) ;
S2 = symsum( (sin( n*pi*y(j))/n)*exp(-0.5*t(i)/E)*(1+0.5*t(i)/E ) , n, p, p) ;
S3 = symsum( (sin( n*pi*y(j))/n)*exp(-0.5*t(i)/E)*( cos(0.5*((-1+4*n*n*pi*pi*E)^0.5)*t(i)/E)+ ((1/(-1+4*n*n*pi*pi*E))^0.5) *sin(0.5*((-1+4*n*n*pi*pi*E)^0.5)*t(i)/E)) , n, p+1, inf) ;
summ=S1+S3+S2;
u(j,i)= 1-y(j)-(2/pi)*(summ);
j=j+1;
end
i=i+1
end
else
i=1;
while i<(length(t)+1)
j=1;
while j<(length(y)+1)
o=floor(p);
S1 = symsum( (sin( n*pi*y(j))/n)*exp(-0.5*t(i)/E)*( cosh(0.5*((1-4*n*n*pi*pi*E)^0.5)*t(i)/E)+ ((1/(1-4*n*n*pi*pi*E))^0.5) *sinh(0.5*((1-4*n*n*pi*pi*E)^0.5)*t(i)/E)) , n, 1, o) ;
S3 = symsum( (sin( n*pi*y(j))/n)*exp(-0.5*t(i)/E)*( cos(0.5*((-1+4*n*n*pi*pi*E)^0.5)*t(i)/E)+ ((1/(-1+4*n*n*pi*pi*E))^0.5) *sin(0.5*((-1+4*n*n*pi*pi*E)^0.5)*t(i)/E)) , n, o, inf) ;
summ=S1+S3;
u(j,i)= 1-y(j)-(2/pi)*(summ);
j=j+1;
end
i=i+1
end
end
g=double(u);
u=g;
l=[y u];
[g,h]=size(l);
plot(y,l)
figure;
C2 = zeros(g,h);
for I = 1:h,
C2(:,I) = smooth(l(:,I));
end
size(C2);
plot(y,C2)
% code
The error is Error using symengine DOUBLE cannot convert the input expression into a double array.
Error in sym/double (line 613) Xstr = mupadmex('symobj::double', S.s, 0);
Error in dennInf (line 63) g=double(u);

Respuestas (0)

Categorías

Más información sobre Vector Fields en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by