Problem solving system of differential equations using dsolve()
Información
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
I get the following error for this following code. I am not sure how to resolve it.
Unable to perform assignment because the size of the left side is
1-by-1 and the size of the right side is 4-by-1.
Error in sym/privsubsasgn (line 1126)
L_tilde2 =
builtin('subsasgn',L_tilde,struct('type','()','subs',{varargin}),R_tilde);
Error in sym/cat>catMany (line 44)
y = privsubsasgn(y,arrays{k},subs{:});
Error in sym/cat (line 27)
ySym = catMany(dim, args);
Error in sym/horzcat (line 19)
ySym = cat(2,args{:});
Error in AERO306HW4 (line 146)
[VLSol, VsubLSol, DVLSol, MsubLSol] = dsolve([odes, conds, x]);
syms VL(x) VsubL(x) MsubL(x)
DVL = diff(VL,x);
ode1 = DVL == (500 + VsubL - *VL)./(0.75);
ode2 = DVL == (0 - VsubL - (27/64).*VL)./(27/128);
ode3 = DVL == ((-250/3) + MsubL - (-1/2).*VL)./(1/3);
ode4 = DVL == (0 - MsubL - (1/16).*VL)./(1/24);
odes = [ode1; ode2; ode3; ode4];
cond1 = VL(0) == 0;
cond2 = DVL(0) == 0;
cond3 = VL(2*L) == 0;
cond4 = DVL(2*L) == 0;
conds = [cond1; cond2; cond3; cond4];
[VLSol, VsubLSol, DVLSol, MsubLSol] = dsolve([odes, conds, x]);
1 comentario
darova
el 19 de Mzo. de 2020
Can you attach original equatoins?
Respuestas (1)
Devineni Aslesha
el 24 de Mzo. de 2020
The input odes to the dsolve function can be a vector only when the number of indeterminates are equal to the number of odes. However, in the given code, only one indeterminate is available i.e. VL as all the four odes are defined with the LHS term DVL. So, the ode input should be a scalar. Try solving the differential equations as shown below.
VLSol(x) = dsolve(ode1, cond1);
For more information, refer to ‘Solve System Of Differential Equations’ from here
La pregunta está cerrada.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!