How could I solve this error?
3 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
darova
on 23 Aug 2021
You are using the same variable as in for loop. That why you have an error
0 Comments
More Answers (0)
See Also
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!