How could I solve this error?
Mostrar comentarios más antiguos
this code does not have any problem with respect to r and t, but when I add interval for t and r it gives this error
thanks for helping
B=(2/pi)^(1/2);
r1=0.00001;
k=0.42;
Cp=3600;
g=1000;
rho=1048;
Tb=37;
qm=300;
w=0.0005;
ra=0.01;
%%
c=w*rho*Cp;
r_distance=ra*2;
time_total=1;
dr=r_distance/10;
dt=0.1;
rmesh=0:dr:r_distance;
tmesh=0:dt:time_total;
rskip=2;
tskip=2;
number_iterations=2;
nr=length(rmesh);
nt=length(tmesh);
V=zeros(nt,nr);
for i=1:nt
for j=1:nt
for m=1:number_iterations
q = int((((B*(rp*sqrt(c))^(-0.5)*sin(rp*sqrt(c))/(sqrt(rp)*B*(sqrt(c))^(-0.5)*sin(sqrt(c)))))-1)*rp*sin(m*pi*rp),rp,0,1); % the integral r prime from 0 to 1
first_term = symsum((exp((m*pi)^2+c)*(-tmesh(j)))*sin(m*pi*rmesh(i))*q, m, 1, 10); % a summation
end
end
end
Error using sym/symsum (line 52)
Cannot compute the sum with respect to '1'. The summation index must be a symbolic variable.
Error in test (line 36)
first_term = symsum((exp((m*pi)^2+c)*(-tmesh(j)))*sin(m*pi*rmesh(i))*q, m, 1, 10); % a summation
7 comentarios
darova
el 20 de Ag. de 2021
You don't have any symbolic variables. Why don't just use sum?
Bajdar Nouredine
el 20 de Ag. de 2021
darova
el 20 de Ag. de 2021
You have to declare m as symbolic variable
syms m
Bajdar Nouredine
el 20 de Ag. de 2021
darova
el 20 de Ag. de 2021
Here is the problem: oyu are using the same variable

Bajdar Nouredine
el 20 de Ag. de 2021
darova
el 21 de Ag. de 2021

Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Mathematics en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

