Error : Index Exceeds Matrix Dimensions

1 次查看(过去 30 天)
clc
clear all
V1C = 11;V1O = 12;
FSC = 99;FSO = 100;
V2C = 21;V2O = 22;
V3C = 31;V3O = 32;
PV1O = 51;PV2C = 52;
AU = 41;AD = 42;
P1U = 61;P1D = 62;
P2U = 71;P2D = 72;
%Components%
%valve 1%
NV1 = [4];
TLV1 = [1 11 1 ; 1 12 2 ; 1 99 3 ; 1 99 4 ; 2 12 2 ; 2 11 1 ; 2 100 4 ; 2 99 3 ; 3 11 3 ; 3 12 3 ; 4 11 4 ; 4 12 4 ]
XMV1 = [0];
V1 = automaton(NV1,TLV1,XMV1)
%valve 2%
NV2 = [2]
TLV2 = [1 21 1 ; 1 22 2 ; 2 22 2 ; 2 21 1]
XMV2 = [0]
V2 = automaton(NV2,TLV2,XMV2)
%valve 3%
NV3 = [3]
TLV3 = [1 31 1 ; 1 32 2 ; 2 32 2 ; 2 31 1]
XMV3 = [0]
V3 = automaton(NV3,TLV3,XMV3)
%Pyrovalve 1%
NP1 = [2]
TLP1 = [1 51 2 ; 2 51 2]
XMP1 = [0]
PV1 = automaton(NP1,TLP1,XMP1)
%Pyrovalve 2%
NP2 = [2]
TLP2 = [1 52 2 ; 2 52 2]
XMP2 = [0]
PV2 = automaton(NP2,TLP2,XMP2)
%Accelerometer%
NA = [2]
TLA = [1 41 2 ; 2 42 2]
XMA = [0]
A = automaton(NA,TLA,XMA)
%Pressure 1%
Np1 = [2]
TLp1 = [1 61 2 ; 2 62 2]
XMp1 = [0]
p1 = automaton(Np1,TLp1,XMp1)
%Pressure 2%
Np2 = [2]
TLp2 = [1 71 2 ; 2 72 2]
XMp2 = [0]
p2 = automaton(Np2,TLp2,XMp2)
%Interactions%
%Event of p1 as the function of V1 and PV1%
[p1_V1PV1,states]=sync(V1,PV1);
for i = 1 : size(states,1)
if(states(i,1)==2 && states(i,3)==2)
p1_V1PV1.TL=[p1_V1PV1.TL; i 62 i]
else
p1_V1PV1.TL=[p1_V1PV1.TL; i 61 i]
end
end
Int1 = p1_V1PV1.TL;
%Event of p2 as function of p1 and PV2%
[p2_p1PV2,states]=sync(p1,PV2);
for i = 1 : size(states,2)
if(states(i,1)==2 && states(i,2)==2)
p2_p1PV2.TL=[p2_p1PV2.TL; i 71 i]
else
p2_p1PV2.TL=[p2_p1PV2.TL; i 72 i]
end
end
Int2 = p2_p1PV2.TL;
%Event of A as function of V2,V3 and p2%
[A_V2V3p2,states]=sync(V2,V3,p2);
for i = 1 : size(states,3)
if(states(i,1)==2 && states(i,2)==2)
A_V2V3p2.TL=[A_V2V3p2.TL; i 41 i]
else
A_V2V3p2.TL=[A_V2V3p2.TL; i 42 i]
end
end
Int3 = A_V2V3p2.TL;
%Complete Model%
Prop = sync(V1,V2,V3,PV1,PV2,A,p1,p2,Int1,Int2,Int3)
Can Anyone Help Me In Solving Error For This Code, I am getting output till p1_V1PV1 and then getting
error : - Index exceeds matrix dimensions
  2 个评论
Walter Roberson
Walter Roberson 2020-7-24
I cannot seem to find automaton in any MATLAB Toolbox? sync() exists for vrnode but I do not think you are using those.
As outside observers, we do not know what sizes or datatypes those unknown routines return.
nand  patel
nand patel 2020-7-24
Yes you will not get automaton in MATLAB Toolbox because automaton belongs to another additional file which we have to add it (DECK - Discrete Event Control Kit).

请先登录,再进行评论。

回答(0 个)

产品


版本

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by