Index in position 1 exceeds array bounds (must not exceed 6). Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN.
1 次查看(过去 30 天)
显示 更早的评论
Please help debug. I marked the lines that outputs error.
It gives complex double when I debug it.
This is another version of the code. Any help is appreciated. Thanks!
p_o(n+1,:)=A\R; %%% this one gives warning %%%%
for i = 1:10
if i == 1
qt(n,i)=injection_rate;
Twr=2.6366^10-4*permeability*lamda_w(n,i)*(dydz/delta_x);
S_w(n+1,i)=(1+(rock_compressibility+water_compressibility)*(p_o(n+1,i)-p_o(n,i)))*S_w(n,i)+(delta_time/(VR*porosity))*(Twr*(p_o(n+1,i+1)-p_o(n+1,i))-Twr*(p_cow(n,i+1)-p_cow(n,i))+qt(n,i));
else
qt(n,i)=-WI(n,i)*(p_o(n,i)-p_well);
Twl=Twr;
Twr=2.6366*10^-4*permeability*lamda_w(n,i)*(dydz/delta_x);
S_w(n+1,i)=(1+(rock_compressibility+water_compressibility)*(p_o(n+1,i)-p_o(n,i)))*S_w(n,i)+(delta_time/(VR*porosity))*(Twr*(p_o(n+1,i+1)-p_o(n+1,i))-Twl*(p_o(n+1,i)-p_o(n+1,i-1))-Twr*(p_cow(n,i+1)-p_cow(n,i))+Twl*(p_cow(n,i)-p_cow(n,i-1)));
end
if S_w(n+1,i)<S_wr
S_w(n+1,i)=S_wr;
end
采纳的回答
Sven
2019-3-1
You wrote
2.6366^10-4
instead of
2.6366*10^-4
You could also write it like this
2.6366e-4
This solved any errors and warnings. Here in this line:
p_o(n+1,:)=A\R; %%% this one gives warning %%%%
for i = 1:10
if i == 1
qt(n,i)=injection_rate;
% Before: Twr=2.6366^10-4*permeability*lamda_w(n,i)*(dydz/delta_x);
Twr=2.6366e-4*permeability*lamda_w(n,i)*(dydz/delta_x);
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!