Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Problem solving system of differential equations using dsolve()

1 visualización (últimos 30 días)
Adrian Rosas
Adrian Rosas el 19 de Mzo. de 2020
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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]);

Respuestas (1)

Devineni Aslesha
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!

Translated by