Effacer les filtres
Effacer les filtres

Index exceeds array dimensions. Index value 100 exceeds valid range [1-99] of array D.

1 vue (au cours des 30 derniers jours)
the number of elements appear correct but I get an error, why
i = Columns 1 through 22 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 Columns 23 through 44 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 Columns 45 through 66 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 Columns 67 through 88 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 Columns 89 through 99 90 91 92 93 94 95 96 97 98 99 100 i = Columns 1 through 22 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 Columns 23 through 44 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 Columns 45 through 66 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 Columns 67 through 88 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 Columns 89 through 99 90 91 92 93 94 95 96 97 98 99 100 i = Columns 1 through 22 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 Columns 23 through 44 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 Columns 45 through 66 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 Columns 67 through 88 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 Columns 89 through 99 90 91 92 93 94 95 96 97 98 99 100
Index exceeds array dimensions. Index value 100 exceeds valid range [1-99] of array D. Error in 'simulacao_julio6/MALATB Function1' (line 9) dot_theta=(1/(2*dz))*((D(i+1)+D(i)).*(theta(i+1)-theta(i))/dz -(D(i-1)+D(i)).*(theta(i)-theta(i-1))/dz+(K(i)-K(i-1)));
Component:Stateflow | Category:Runtime error
An error occurred while running the simulation and the simulation was terminated
Caused by:
  • Simulation stopped because of a runtime error.
this is my code
function dot_theta = Richards(theta,K,D,thetaz_0,thetaz_f)
L=1; %comprimento
z=linspace(0,L,100); % espaco de discretizacao
dz=L/length(z);
b=1/(2*dz^2);
i=max([1 0 2]):length(z),
dot_theta=(1/(2*dz))*((D(i+1)+D(i)).*(theta(i+1)-theta(i))/dz -(D(i-1)+D(i)).*(theta(i)-theta(i-1))/dz+(K(i)-K(i-1)));
%condicao de contorno1
%Se o indice do primeiro elemento do vetor for 1 em vez de 0, seria:
dot_theta(1)=dot_theta(1)+thetaz_0/dz;
%Condicao de contorno no ultimo elemento:
dot_theta(99)=dot_theta(99)-thetaz_f/dz;
  3 commentaires
jose luis huayanay villar
jose luis huayanay villar le 10 Juil 2020
yes, D
function D = fcn(theta)
L=1; %comprimento
z=linspace(0,L,100); % espaco de discretizacao
theta_r = 0.218; % conteudo de agua residual
alpha= 0.0115; %parametro de Van Genuchten 1/cm (Van Genuchten, 1980)
K_s = 31.6; % conductividade de saturacao cm/t
theta_s=0.52; %conteudo de agua saturado
n = 2.03;
m=1-(1/n);
i=max([1 0 2]):length(z),
D =(K_s*(1-m)/(alpha*m*(theta_s-theta_r)))*(theta(i-1).^(0.5-(1/m))./(1-(theta(i-1).^(1/m)))).*((1-(1-(theta(i-1).^(1/m))).^m).^2);

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Tags

Produits


Version

R12.1

Community Treasure Hunt

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

Start Hunting!

Translated by