Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Problem solving system of differential equations using dsolve()

조회 수: 2 (최근 30일)
Adrian Rosas
Adrian Rosas 2020년 3월 19일
마감: MATLAB Answer Bot 2021년 8월 20일
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
darova
darova 2020년 3월 19일
Can you attach original equatoins?

답변 (1개)

Devineni Aslesha
Devineni Aslesha 2020년 3월 24일
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

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by