# 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.

3 views (last 30 days)
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

#### 1 Comment

KSSV on 1 Mar 2019

Sven on 1 Mar 2019
You wrote
2.6366^10-4
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);

### Community Treasure Hunt

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

Start Hunting!

Translated by