How could I solve this error?

조회 수: 2 (최근 30일)
Bajdar Nouredine
Bajdar Nouredine 2021년 8월 20일
답변: darova 2021년 8월 23일
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
Bajdar Nouredine
Bajdar Nouredine 2021년 8월 20일
@darova it solved, thanks,
darova
darova 2021년 8월 21일

댓글을 달려면 로그인하십시오.

채택된 답변

darova
darova 2021년 8월 23일
You are using the same variable as in for loop. That why you have an error

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by