MATLAB Answers

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 件のコメント
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 件)

Community Treasure Hunt

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

Start Hunting!

Translated by