problemas en las dimensiones de una matriz
Publicado por Lorena (6 intervenciones) el 25/06/2018 13:37:03
Estoy ejecutando el siguiente código :
Pero cuando lo ejecuto me sale este error:
Error using odearguments (line 95)
@(T,Y)MODELO(T,Y,Y0,VARIABLES,NUM_VAR,NUM_BR) returns a vector of length 10, but the length of initial conditions vector
is 100. The vector returned by @(T,Y)MODELO(T,Y,Y0,VARIABLES,NUM_VAR,NUM_BR) and the initial conditions vector must have
the same number of elements.
Error in ode15s (line 150)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in modelSimulation (line 57)
Alguien sabe que debo hacer?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
num_br= 10; % número de reactores en serie
num_var=num_br; % número de variables por reactor
t_end = 72; % duracion del ensayo
t_step = 0.2; % cambio
tspan = 0:t_step:t_end; % vector tiempo
X0=1
S0=100
DOTm0=0.1
A0=0
PS0=0
Y0 = [X0, S0, DOTm0, A0, PS0];
Parametros = [
0.3492
0.0280
9.9405
0.1692
0.9999
0.4004
1.7614
0.03
0.04
1
0.9994
1.4876
4.6885
0.4223
0.0102
0.0700
17.8980
429.2238];
P = 0.1; % Concentracion
Volume = 4; % Volumen del reactor
options = odeset('RelTol',1e-4);
y0=zeros(1,num_br*num_var);
y0(1)=X0;
y0(2:num_var:end)=S0;
y0(3:num_var:end)=DOTm0;
y0(4:num_var:end)=A0;
y0(5:num_var:end)=PS0;
Variables = [Parametros', P, Volume];
[t,y] = ode15s(@(t,y)modelo(t,y,Y0,Variables,num_var,num_br),tspan,y0,options);
%Parse out the state values
X = y(:,1:num_var:end);
S = y(:,2:num_var:end);
DOTm = y(:,3:num_var:end);
A = y(:,4:num_var:end)
PS = y(:,5:num_var:end)
Pero cuando lo ejecuto me sale este error:
Error using odearguments (line 95)
@(T,Y)MODELO(T,Y,Y0,VARIABLES,NUM_VAR,NUM_BR) returns a vector of length 10, but the length of initial conditions vector
is 100. The vector returned by @(T,Y)MODELO(T,Y,Y0,VARIABLES,NUM_VAR,NUM_BR) and the initial conditions vector must have
the same number of elements.
Error in ode15s (line 150)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in modelSimulation (line 57)
1
[t,y] = ode15s(@(t,y)modelo(t,y,Y0,Variables,num_var,num_br),tspan,y0,options);
Alguien sabe que debo hacer?
Valora esta pregunta
0