MATLAB: The message “Array indices must be positive integers or logical values.” is displayed

arrayindexingMATLABsymbolic

When I run this code, the following error message "Array indices must be positive integers or logical values" is displayed.
syms z y z
%ACDC parameters
alpha_x = 3.9e-2;
beta_x = 6.1;
z_x = 1.3e-5;
n_zx = 2.32;
alpha_y= 4.3e-2;
beta_y = 5.7;
x_y = 7.9e-4;
n_xy = n_zx;
delta_y = 1.05;
x_z = 12e-2;
n_xz = n_zx;
y_z = 11e-3;
n_yz = n_zx;
delta_z = 1.04;
S = 10^2;%(t.*8/100-2);
C1=[1 0 -(n_zx(alpha_x+beta_x*S)*((z)/(z_x))^(-1+n_zx)/(1+S+(z/z_x)))];
C2=[1 0 (x(2)/y_z)^n_yz-delta_z*x(3)];
C3=[1 0 -(n_zx(alpha_x+beta_x*S)*(z/z_x)^(-1+n_zx)/(1+S+(Z/z_x))) ];
Jacobi=[C1; C2; C3]
How could I fixed?

Best Answer

Do change
C1=[1 0 -(n_zx*(alpha_x+beta_x*S)*((z)/(z_x))^(-1+n_zx)/(1+S+(z/z_x)))];
In the following x is not define, you trying to access x as array
C2=[1 0 (x(2)/y_z)^n_yz-delta_z*x(3)];
%........^.......................^....
In the intial line
syms z y z
%....^...^ same ...is it x?