Invalid expression. When calling a function or indexing a variable

3 views (last 30 days)
Imene Yed
Imene Yed on 1 Jun 2021
Commented: Imene Yed on 1 Jun 2021
Hi, I'm trying to name the variables of my function n(1)=[C]. n(2)= [C+].. but it doesnt seem to work
function dndt = myequations(t,n,k)
[C]= n(1)
[C+]=n(2)
[C-]=n(3)
[O]= n(4)
[O+]=n(5)
[O-]=n(6)
[N]= n(7)
[N+]=n(8)
[C2]=n(9)
[C2(d)]=n(10)
[C2+]=n(11)
[C2-]=n(12)
[C3]= n(13)
[C3-]=n(14)
[O2]= n(15)
[O2(a)]=n(16)
[O2(b)]=n(17)
[O2-]=n(18)
[O2+]=n(19)
[N2]=n(20)
[N2+]=n(21)
[CO]=n(22)
[CO+]=n(23)
[NO]=n(24)
[NO+]=n(25)
[CN]=n(26)
[CN+]=n(27)
[CN-]=n(28)
[N2O]=n(30)
[NO2]=n(32)
[C2N]=n(35)
[CNO]=n(36)
[OCN]=n(37)
[e]=n(42)
[Photon]=n(43)
dndt = zeros(43,1);
%Chemin C
dndt(1)= k(1)*[C+]*[e]+k(15)*[O+]*[C2]+k(16)*[O+]*[CN]+k(25)*[O]*[CN]...
+k(29)*[O]*[C2]+k(33)*[O]*[C2+]+k(39)*[N]*[CN]+k(40)*[N]*[CN+]...
+k(43)*[N]*[C2]+k(44)*[N]*[C2-]+k(48)*[C2]*[C2]+k(59)*[C2+]*[e]...
+k(72)*[C+]*[NO]+k(104)*[C-]*[O+]+k(105)*[C-]*[N+]+k(106)*[C-]*[NO+]...
+k(117)*[O2-]*[C+]+k(119)*[C-]*[Photon]+k(122)*[C2+]*[Photon]+k(124)*[C3]*[Photon]...
+k(130)*[CO]*[Photon]-k(4)*[C]*[OCN]-k(8)*[C]*[O2]-k(9)*[C]*[CN]...
-k(10)*[C]*[NO]-k(11)*[C]*[N2]-k(12)*[C]*[C2N]-k(13)*[C]*[CO]...
-k(61)*[C+]*[C]-k(64)*[C]*[C3]-k(65)*[C]*[O]-k(66)*[C]*[C2]...
-k(67)*[C]*[O+]-k(68)*[C]*[C]-k(69)*[C]*[N]-k(73)*[C]*[CN+]...
-k(74)*[C]*[C2+]-k(75)*[C]*[CO+]-k(76)*[C]*[N2+]-k(77)*[C]*[O2+]...
-k(118)*[C]*[Photon]-k(132)*[C]*[e]-k(136)*[C]*[C-]-k(137)*[C]*[C2-]...
-k(138)*[C]*[C3-]-k(139)*[C]*[O-]-2*k(164)*[N]*[C]*[C]...
+k(164)*[N]*[C]^(2)-k(163)*[C]*[O2]*[O]+k(163)*[C]*[O2]*[O]...
-k(165)*[C]*[NO2]*[O]+k(165)*[C]*[NO2]*[O];
%Chemin C+:
dndt(2)= -k(1)*[C+]*[e]-k(5)*[C+]*[O2]-k(6)*[C+]*[N2O]-k(7)*[C+]*[CNO]...
-k(61)*[C+]*[C]-k(62)*[C+]*[N]-k(63)*[C+]*[O]-k(72)*[C+]*[NO]...
-k(117)*[O2-]*[C+]+k(45)*[N]*[C2+]+k(73)*[C]*[CN+]...
+k(74)*[C]*[C2+]+k(75)*[C]*[CO+]+k(76)*[C]*[N2+]...
+k(77)*[C]*[O2+]+k(118)*[C]*[Photon]+k(122)*[C2+]*[Photon];
%Chemin C-:
dndt(3)= k(32)*[O]*[C2-]+k(132)*[C]*[e]-k(14)*[C-]*[NO]-k(104)*[C-]*[O+]...
-k(105)*[C-]*[N+]-k(106)*[C-]*[NO+]-k(119)*[C-]*[Photon]...
-k(136)*[C]*[C-]-k(140)*[C-]*[O]-k(141)*[C-]*[O2]-k(142)*[C-]*[N];
%Chemin O:
dndt(4)= k(2)*[O+]*[e]+k(8)*[C]*[O2]+k(10)*[C]*[NO]+k(13)*[C]*[CO]...
+k(14)*[C-]*[NO]+k(35)*[N]*[O2]+k(36)*[N]*[O2+]...
+k(37)*[N]*[NO]+k(38)*[N]*[NO2]+k(52)*[O2]*[NO]...
+k(53)*[O2]*[N2]+k(55)*[O2]*[CO]+k(56)*[O2]*[CN]...
+k(78)*[O+]*[C2]+k(79)*[O+]*[CO]+k(80)*[O+]*[N2O]...
+k(81)*[O+]*[O2]+k(84)*[O-]*[O2]+k(85)*[O-]*[CN]...
+k(104)*[C-]*[O+]+2*k(107)*[O+]*[O-]+k(108)*[O+]*[O2-]...
+k(109)*[O-]*[N+]+k(120)*[O-]*[Photon]+2*k(126)*[O2]*[Photon]...
+k(128)*[O2+]*[Photon]+k(130)*[CO]*[Photon]+k(131)*[NO]*[Photon]...
+k(162)*[e]*[O]*[O2]-k(19)*[O]*[NO]-k(20)*[O]*[NO2]...
-k(21)*[O]*[N2O]-k(22)*[O]*[N2O]-k(23)*[O]*[N2]...
-k(24)*[O]*[CNO]-k(25)*[O]*[CN]-k(26)*[O]*[CN]...
-k(27)*[O]*[C3]-k(28)*[O]*[C2N]-k(29)*[O]*[C2]...
-k(30)*[O]*[N2+]-k(31)*[O]*[C3-]-k(32)*[O]*[C2-]...
-k(33)*[O]*[C2+]-k(63)*[C+]*[O]-k(65)*[C]*[O]...
-2*k(70)*[O]*[O]-k(82)*[O]*[N2+]-k(83)*[O]*[CO+]...
-k(133)*[O]*[e]-k(140)*[C-]*[O]-k(143)*[O]*[O-]...
-k(144)*[O]*[C2-]-k(161)*[e]*[O]*[O2]...
-k(162)*[e]*[O]*[O2]-k(163)*[C]*[O2]*[O]-k(165)*[C]*[NO2]*[O];
%Chemin O+:
dndt(5)= +k(5)*[C+]*[O2]+k(34)*[N+]*[O2]...
+k(82)*[O]*[N2+]+k(83)*[O]*[CO+]...
+k(128)*[O2+]*[hv]-k(2)*[O+]*[e]...
-k(15)*[O+]*[C2]-k(16)*[O+]*[CN]...
-k(17)*[O+]*[NO2]-k(18)*[O+]*[N2]-k(67)*[C]*[O+]...
-k(78)*[O+]*[C2]-k(79)*[O+]*[CO]-k(80)*[O+]*[N2O]...
-k(81)*[O+]*[O2]-k(104)*[C]*[O+]-k(107)*[O+]*[O-]...
-k(108)*[O+]*[O2];
%Chemin O-:
dndt(6)= k(133)*[O]*[e]+k(161)*[e]*[O]*[O2]-k(84)*[O-]*[O2]...
-k(85)*[O-]*[CN]-k(107)*[O+]*[O-]-k(109)*[O-]*[N+]-k(120)*[O-]*[Photon]...
-k(139)*[C]*[O-]-k(143)*[O]*[O-]-k(145)*[O-]*[NO]...
-k(146)*[O-]*[CO]-k(147)*[O-]*[N];
%Chemin N:
dndt(7)= k(3)*[N+]*[e]+k(9)*[C]*[CN]+k(11)*[C]*[N2]...
+k(18)*[O+]*[N2]+k(19)*[O]*[NO]+k(23)*[O]*[N2]...
+k(26)*[O]*[CN]+k(30)*[O]*[N2+]+2*k(60)*[N2+]*[e]...
+k(86)*[N+]*[O2]+k(87)*[N+]*[C2]+k(88)*[N+]*[CO]...
+k(89)*[N+]*[CN]+k(90)*[N+]*[NO]+k(105)*[C-]*[N+]...
+k(109)*[O-]*[N+]+k(110)*[N+]*[O2-]+k(111)*[N+]*[C2-]...
+k(112)*[N+]*[CN-]+k(113)*[N+]*[C3-]+2*k(129)*[N2]*[Photon]...
+k(131)*[NO]*[Photon]+2*k(159)*[N2]*[e]-k(35)*[N]*[O2]...
-k(36)*[N]*[O2+]-k(37)*[N]*[NO]-k(38)*[N]*[NO2]...
-k(39)*[N]*[CN]-k(40)*[N]*[CN+]-k(41)*[N]*[C3]...
-k(42)*[N]*[C3-]-k(43)*[N]*[C2]-k(44)*[N]*[C2-]...
-k(45)*[N]*[C2+]-k(46)*[N]*[C2N]-k(62)*[C+]*[N]...
-k(69)*[C]*[N]-k(71)*[N+]*[N]-k(91)*[N]*[N2+]...
-k(142)*[C-]*[N]-k(147)*[O-]*[N]-k(164)*[N]*[C]*[C];
%Chemin N+:
dndt(8)=k(91)*[N]*[N2+]-k(3)*[N+]*[e]-k(34)*[N+]*[O2]...
-k(71)*[N+]*[N]-k(86)*[N+]*[O2]-k(87)*[N+]*[C2]...
-k(88)*[N+]*[CO]-k(89)*[N+]*[CN]-k(90)*[N+]*[NO]...
-k(105)*[C-]*[N+]-k(109)*[O-]*[N+]-k(110)*[N+]*[O2-]...
-k(111)*[N+]*[C2-]-k(112)*[N+]*[CN-]-k(113)*[N+]*[C3-];
%Chemin C2:
dndt(9)= k(9)*[C]*[CN]+k(12)*[C]*[C2N]+k(13)*[C]*[CO]...
+k(27)*[O]*[C3]+k(41)*[N]*[C3]+k(68)*[C]*[C]...
+k(74)*[C]*[C2+]+k(94)*[C2+]*[NO]+k(111)*[N+]*[C2-]...
+k(115)*[C2-]*[NO+]+k(121)*[C2]*[Photon]+k(123)*[C2-]*[Photon]...
+k(124)*[C3]*[Photon]+k(136)*[C]*[C-]+k(153)*[C2(d)]*[e]...
+k(154)*[C2(d)]^(2)+k(155)*[C2(d)]*[C]-k(15)*[O+]*[C2]...
-k(29)*[O]*[C2]-k(43)*[N]*[C2]-k(47)*[C2]*[O2]...
-2*k(48)*[C2]*[C2]-k(49)*[C2]*[O2+]-k(66)*[C]*[C2]...
-k(78)*[O+]*[C2]-k(87)*[N+]*[C2]-k(92)*[C2]*[CO+]...
-k(93)*[C2]*[CN+]-k(121)*[C2]*[Photon]-k(134)*[C2]*[e]...
-k(148)*[C2]*[C2-]-k(150)*[C2]*[e];
%Chemin C2(d)
dndt(10)= k(150)*[C2]*[e]-k(153)*[C2(d)]*[e]-k(154)*[C2(d)]^(2)-k(155)*[C2(d)]*[C];
%Chemin C2+:
dndt(11)= k(61)*[C+]*[C]+k(78)*[O+]*[C2]+k(87)*[N+]*[C2]...
+k(92)*[C2]*[CO+]+k(93)*[C2]*[CN+]-k(33)*[O]*[C2+]...
-k(45)*[N]*[C2+]-k(50)*[C2+]*[O2]-k(59)*[C2+]*[e]...
-k(74)*[C]*[C2+]-k(94)*[C2+]*[NO]-k(122)*[C2+]*[Photon];
%Chemin C2-:
dndt(12)= -k(32)*[O]*[C2-]-k(44)*[N]*[C2-]-k(111)*[N+]*[C2-]...
-k(115)*[C2-]*[NO+]-k(123)*[C2-]*[Photon]-k(137)*[C]*[C2-]...
-k(144)*[O]*[C2-]-k(148)*[C2]*[C2-]-k(149)*[C2-]*[C3]...
+k(31)*[O]*[C3-]+k(42)*[N]*[C3-]+k(134)*[C2]*[e];
%Chemin C3:
dndt(13)= k(48)*[C2]*[C2]+k(66)*[C]*[C2]+k(113)*[N+]*[C3-]...
+k(114)*[C3-]*[NO+]+k(125)*[C3-]*[Photon]...
+k(137)*[C]*[C2-]-k(27)*[O]*[C3]-k(41)*[N]*[C3]...
-k(64)*[C]*[C3]-k(124)*[C3]*[Photon]...
-k(135)*[C3]*[e]-k(149)*[C2-]*[C3];
%Chemin C3-:
dndt(14)= k(135)*[C3]*[e]-k(31)*[O]*[C3-]...
-k(42)*[N]*[C3-]-k(113)*[N+]*[C3-]...
-k(114)*[C3-]*[NO+]-k(125)*[C3-]*[Photon]-k(138)*[C]*[C3-];
%Chemin O2:
dndt(15)= k(17)*[O+]*[NO2]+k(19)*[O]*[NO]+k(20)*[O]*[NO2]...
+k(21)*[O]*[N2O]+k(57)*[NO]*[NO]+k(70)*[O]*[O]...
+k(77)*[C]*[O2+]+k(97)*[O2+]*[NO2]+k(98)*[O2+]*[NO]...
+k(108)*[O+]*[O2-]+k(110)*[N+]*[O2-]+k(116)*[O2-]*[NO+]...
+k(117)*[O2-]*[C+]+k(127)*[O2-]*[Photon]+k(143)*[O]*[O-]...
+2*k(156)*[O2-]*[O2]+2*k(157)*[O2-]*[O2(a)]...
+2*k(158)*[O2-]*[O2(b)]+k(161)*[e]*[O]*[O2]...
-k(5)*[C+]*[O2]-k(8)*[C]*[O2]-k(34)*[N+]*[O2]...
-k(35)*[N]*[O2]-k(47)*[C2]*[O2]-k(50)*[C2+]*[O2]...
-k(51)*[O2]*[OCN]-k(52)*[O2]*[NO]-k(53)*[O2]*[N2]...
-k(54)*[O2]*[CN+]-k(55)*[O2]*[CO]-k(56)*[O2]*[CN]...
-k(81)*[O+]*[O2]-k(84)*[O-]*[O2]-k(86)*[N+]*[O2]...
-k(95)*[O2]*[N2+]-k(96)*[O2]*[CO+]-k(126)*[O2]*[Photon]...
-k(141)*[C-]*[O2]-k(151)*[O2]*[e]-k(152)*[O2]*[e]...
-k(156)*[O2-]*[O2]-k(161)*[e]*[O]*[O2]...
-k(162)*[e]*[O]*[O2]-k(163)*[C]*[O2]*[O];
%Chemin O2(a):
dndt(16)= k(151)*[e]*[O2]-k(157)*[O2(a)]*[O2-];
%Chemin O2(b):
dndt(17)= k(152)*[e]*[O2]-k(158)*[O2(b)]*[O2-];
%Chemin O2-:
dndt(18)= k(84)*[O-]*[O2]+k(162)*[e]*[O]*[O2]...
-k(108)*[O+]*[O2-]-k(110)*[N+]*[O2-]...
-k(116)*[O2-]*[NO+]-k(117)*[O2-]*[C+]-k(127)*[O2-]*[Photon]...
-k(156)*[O2-]*[O2]-k(157)*[O2-]*[O2(a)]-k(158)*[O2-]*[O2(b)];
%Chemin O2+:
dndt(19)= k(81)*[O+]*[O2]+k(86)*[N+]*[O2]+k(95)*[O2]*[N2+]...
+k(96)*[O2]*[CO+]-k(36)*[N]*[O2+]-k(49)*[C2]*[O2+]-k(77)*[C]*[O2+]...
-k(97)*[O2+]*[NO2]-k(98)*[O2+]*[NO]-k(128)*[O2+]*[Photon];
%Chemin N2:
dndt(20)= k(21)*[O]*[N2O]+k(37)*[N]*[NO]+k(39)*[N]*[CN]...
+k(57)*[NO]*[NO]+k(76)*[C]*[N2+]+k(82)*[O]*[N2+]...
+k(91)*[N]*[N2+]+k(95)*[O2]*[N2+]+k(99)*[N2+]*[CN]...
+k(100)*[N2+]*[CO]-k(11)*[C]*[N2]-k(18)*[O+]*[N2]...
-k(23)*[O]*[N2]-k(53)*[O2]*[N2]...
-k(129)*[N2]*[Photon]-k(159)*[N2]*[e]-k(160)*[N2]*[e];
%Chemin N2+:
dndt(21)= k(40)*[N]*[CN+]+k(71)*[N+]*[N]+k(160)*[N2]*[e]...
-k(30)*[O]*[N2+]-k(60)*[N2+]*[e]-k(76)*[C]*[N2+]...
-k(82)*[O]*[N2+]-k(91)*[N]*[N2+]...
-k(95)*[O2]*[N2+]-k(99)*[N2+]*[CN]-k(100)*[N2+]*[CO];
%Chemin CO:
dndt(22)= k(4)*[C]*[OCN]+k(5)*[C+]*[O2]+k(8)*[C]*[O2]...
+k(24)*[O]*[CNO]+k(26)*[O]*[CN]+k(27)*[O]*[C3]...
+k(28)*[O]*[C2N]+k(29)*[O]*[C2]+k(31)*[O]*[C3-]...
+k(32)*[O]*[C2-]+2*k(47)*[C2]*[O2]+k(49)*[C2]*[O2+]...
+k(50)*[C2+]*[O2]+k(54)*[O2]*[CN+]+k(58)*[NO]*[OCN]...
+k(65)*[C]*[O]+k(75)*[C]*[CO+]+k(83)*[O]*[CO+]...
+k(92)*[C2]*[CO+]+k(96)*[O2]*[CO+]+k(102)*[NO]*[CO+]...
+k(139)*[C]*[O-]+k(140)*[C-]*[O]-k(13)*[C]*[CO]...
-k(55)*[O2]*[CO]-k(79)*[O+]*[CO]-k(88)*[N+]*[CO]...
-k(100)*[N2+]*[CO]-k(101)*[CO]*[CN+]...
-k(130)*[CO]*[Photon]-k(146)*[O-]*[CO];
%Chemin CO+:
dndt(23)= k(7)*[C+]*[CNO]+k(15)*[O+]*[C2]+k(33)*[O]*[C2+]...
+k(49)*[C2]*[O2+]+k(50)*[C2+]*[O2]+k(63)*[C+]*[O]...
+k(67)*[C]*[O+]+k(79)*[O+]*[CO]+k(88)*[N+]*[CO]...
+k(100)*[N2+]*[CO]+k(101)*[CO]*[CN+]-k(75)*[C]*[CO+]...
-k(83)*[O]*[CO+]-k(92)*[C2]*[CO+]...
-k(96)*[O2]*[CO+]-k(102)*[NO]*[CO+];
%Chemin NO:
dndt(24)= k(20)*[O]*[NO2]+k(22)*2*[O]*[N2O]+k(23)*[O]*[N2]...
+k(24)*[O]*[CNO]+k(25)*[O]*[CN]+k(34)*[N+]*[O2]...
+k(35)*[N]*[O2]+k(51)*[O2]*[OCN]+k(106)*[C-]*[NO+]...
+k(114)*[C3-]*[NO+]+k(115)*[C2-]*[NO+]+k(116)*[O2-]*[NO+]...
+k(147)*[O-]*[N]-k(10)*[C]*[NO]-k(14)*[C-]*[NO]-k(19)*[O]*[NO]...
-k(37)*[N]*[NO]-k(52)*[O2]*[NO]-k(57)*2*[NO]*[NO]...
-k(58)*[NO]*[OCN]-k(72)*[C+]*[NO]-k(90)*[N+]*[NO]...
-k(94)*[C2+]*[NO]-k(98)*[O2+]*[NO]-k(102)*[NO]*[CO+]...
-k(103)*[NO]*[CN+]-k(131)*[NO]*[Photon]-k(145)*[O-]*[NO];
%Chemin NO+:
dndt(25)= k(6)*[C+]*[N2O]+k(16)*[O+]*[CN]+k(17)*[O+]*[NO2]...
+k(18)*[O+]*[N2]+k(30)*[O]*[N2+]+k(36)*[N]*[O2+]...
+k(54)*[O2]*[CN+]+k(72)*[C+]*[NO]+k(90)*[N+]*[NO]...
+k(94)*[C2+]*[NO]+k(98)*[O2+]*[NO]+k(102)*[NO]*[CO+]...
+k(103)*[NO]*[CN+]-k(106)*[C-]*[NO+]-k(114)*[C3-]*[NO+]...
-k(115)*[C2-]*[NO+]-k(116)*[O2-]*[NO+];
%Chemin CN:
dndt(26)= k(4)*[C]*[OCN]+k(6)*[C+]*[N2O]+k(7)*[C+]*[CNO]...
+k(10)*[C]*[NO]+k(11)*[C]*[N2]+k(12)*[C]*[C2N]...
+k(28)*[O]*[C2N]+k(41)*[N]*[C3]+k(42)*[N]*[C3-]...
+k(43)*[N]*[C2]+k(45)*[N]*[C2+]+k(46)*2*[N]*[C2N]...
+k(69)*[C]*[N]+k(73)*[C]*[CN+]+k(93)*[C2]*[CN+]...
+k(101)*[CO]*[CN+]+k(103)*[NO]*[CN+]...
+k(112)*[N+]*[CN-]+k(142)*[C-]*[N]...
+k(164)*[N]*[C]*[C]-k(9)*[C]*[CN]-k(16)*[O+]*[CN]...
-k(25)*[O]*[CN]-k(26)*[O]*[CN]-k(39)*[N]*[CN]...
-k(56)*[O2]*[CN]-k(85)*[O-]*[CN]...
-k(89)*[N+]*[CN]-k(99)*[N2+]*[CN];
%Chemin CN+:
dndt(27)= k(62)*[C+]*[N]+k(89)*[N+]*[CN]+k(99)*[N2+]*[CN]...
-k(40)*[N]*[CN+]-k(54)*[O2]*[CN+]...
-k(73)*[C]*[CN+]-k(93)*[C2]*[CN+]...
-k(101)*[CO]*[CN+]-k(103)*[NO]*[CN+];
%Chemin CN-:
dndt(28)= k(14)*[C-]*[NO]+k(44)*[N]*[C2-]+k(85)*[O-]*[CN]-k(112)*[N+]*[CN-];
%Chemin O3:
dndt(29)= k(163)*[C]*[O2]*[O];
%Chemin N2O:
dndt(30)= k(38)*[N]*[NO2]+k(53)*[O2]*[N2]+k(58)*[NO]*[OCN]...
-k(6)*[C+]*[N2O]-k(21)*[O]*[N2O]...
-k(22)*[O]*[N2O]-k(80)*[O+]*[N2O];
%Chemin N2O+:
dndt(31)= k(80)*[O+]*[N2O];
%Chemin NO2:
dndt(32)= k(52)*[O2]*[NO]+k(145)*[O-]*[NO]-k(17)*[O+]*[NO2]...
-k(20)*[O]*[NO2]-k(38)*[N]*[NO2]...
-k(97)*[O2+]*[NO2]-k(165)*[C]*[NO2]*[O];
%Chemin NO2+:
dndt(33)= k(97)*[O2+]*[NO2];
%Chemin CO2:
dndt(34)= k(51)*[O2]*[OCN]+k(55)*[O2]*[CO]...
+k(141)*[C-]*[O2]+k(146)*[O-]*[CO];
%Chemin C2N:
dndt(35)= -k(12)*[C]*[C2N]-k(28)*[O]*[C2N]-k(46)*[N]*[C2N];
%Chemin CNO:
dndt(36)= -k(7)*[C+]*[CNO]-k(24)*[O]*[CNO];
%Chemin OCN
dndt(37)= -k(4)*[C]*[OCN]-k(51)*[O2]*[OCN]...
-k(58)*[NO]*[OCN]+k(56)*[O2]*[CN];
%Chemin NO3:
dndt(38)= k(165)*[C]*[NO2]*[O];
%Chemin C2O:
dndt(39)= k(144)*[O]*[C2-];
%Chemin C4:
dndt(40)= k(64)*[C]*[C3]+k(138)*[C]*[C3-]+k(148)*[C2]*[C2-];
%Chemin C5:
dndt(41)= k(149)*[C2-]*[C3];
%Chemin e:
dndt(42)= k(118)*[C]*[Photon]+k(119)*[C-]*[Photon]+k(120)*[O-]*[Photon]...
+k(121)*[C2-]*[Photon]+k(123)*[C2-]*[Photon]+k(125)*[C3-]*[Photon]...
+k(127)*[O2-]*[Photon]+k(136)*[C]*[C-]+k(137)*[C]*[C2-]...
+k(138)*[C]*[C3-]+k(139)*[C]*[O-]+k(140)*[C-]*[O]...
+k(141)*[C-]*[O2]+k(142)*[C-]*[N]+k(143)*[O]*[O-]...
+k(144)*[O]*[C2-]+k(145)*[O-]*[NO]+k(146)*[O-]*[CO]...
+k(147)*[O-]*[N]+k(148)*[C2]*[C2-]+k(149)*[C2-]*[C3]...
+k(150)*[C2]*[e]+k(151)*[O2]*[e]+k(152)*[O2]*[e]...
+k(153)*[C2(d)]*[e]+k(156)*[O2-]*[O2]+k(157)*[O2-]*[O2(a)]...
+k(158)*[O2-]*[O2(b)]+k(159)*[N2]*[e]...
+2*k(160)*[N2]*[e]-k(1)*[C+]*[e]-k(2)*[O+]*[e]...
-k(3)*[N+]*[e]-k(59)*[C2+]*[e]-k(60)*[N2+]*[e]...
-k(132)*[C]*[e]-k(133)*[O]*[e]-k(134)*[C2]*[e]...
-k(135)*[C3]*[e]-k(150)*[C2]*[e]-k(151)*[O2]*[e]...
-k(152)*[O2]*[e]-k(153)*[C2(d)]*[e]-k(159)*[N2]*[e]...
-k(160)*[N2]*[e]-k(161)*[e]*[O]*[O2]...
-k(162)*[e]*[O]*[O2];
%Chemin hv:
dndt(43)= -k(118)*[C]*[Photon]-k(119)*[C-]*[Photon]-k(120)*[O-]*[Photon]...
-k(121)*[C2]*[Photon]-k(122)*[C2+]*[Photon]-k(123)*[C2-]*[Photon]...
-k(124)*[C3]*[Photon]-k(125)*[C3-]*[Photon]-k(126)*[O2]*[Photon]...
-k(127)*[O2-]*[Photon]-k(128)*[O2+]*[Photon]-k(129)*[N2]*[Photon]...
-k(130)*[CO]*[Photon]-k(131)*[NO]*[Photon]+k(1)*[C+]*[e]...
+k(2)*[O+]*[e]+k(3)*[N+]*[e]+k(61)*[C+]*[C]...
+k(62)*[C+]*[N]+k(63)*[C+]*[O]+k(64)*[C]*[C3]...
+k(65)*[C]*[O]+k(66)*[C]*[C2]+k(67)*[C]*[O+]...
+k(68)*[C]*[C]+k(69)*[C]*[N]+k(70)*[O]*[O]...
+k(71)*[N+]*[N]+k(132)*[C]*[e]+k(133)*[O]*[e]...
+k(134)*[C2]*[e]+k(135)*[C3]*[e];
end
>> myequations
Error: File: myequations.m Line: 3 Column: 8
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for
mismatched delimiters.
  2 Comments

Sign in to comment.

Accepted Answer

Rik
Rik on 1 Jun 2021
Matlab variable names must start with a letter and may contain only letters, numbers, and underscores. Anything not fitting that description is not a valid Matlab variable name.
%in short, it should match this regular expression:
'[a-zA-Z][a-zA-Z0-9_]'
A variable name can't include a +. You will have to pick different names.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!