Error with pdeCoefficient PDE toolbox
조회 수: 7 (최근 30일)
이전 댓글 표시
I am following this Matlab example to code my system of PDE (reequire PDE toolbox)
syms u1(x,y) u2(x,y)
pdeeq = [-laplacian(u1) + u2; -D*laplacian(u2) - pres];
symCoeffs = pdeCoefficients(pdeeq,[u1 u2],'Symbolic',true)
But if Try my Equation, I get an error and I cannot understand why. Any clue?
syms u1(t,x) u2(t,x)
pdeeq = [diff(u1,t) -laplacian(u1) + u2 == 0; diff(u2,t) -laplacian(u2) -u1 ==0];
symCoeffs = pdeCoefficients(pdeeq,[u1 u2],'Symbolic',true)
Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 1-by-2.
Error in sym/privsubsasgn (line 1229)
L_tilde2 = builtin('subsasgn',L_tilde,struct('type','()','subs',{varargin}),R_tilde);
Error in sym/cat>catMany (line 42)
y = privsubsasgn(y,arrays{k},subs{:});
Error in sym/cat (line 25)
ySym = catMany(dim, args);
Error in sym/vertcat (line 19)
ySym = cat(1,args{:});
Error in untitled (line 7)
pdeeq = [diff(u1,t) -laplacian(u1) + u2 == 0; diff(u2,t) -laplacian(u2) -u1 ==0];
댓글 수: 0
답변 (1개)
Pratyush Roy
2022년 2월 16일
Hi Edoardo,
As a workaround, you can try removing the equality operator and express the equations as a function of the variables. You can also express the equations in terms of the variables x and y instead of using t.
The script below might be helpful:
syms u1(x,y) u2(x,y)
pdeeq = [diff(u1,x)-laplacian(u1) + u2; diff(u2,y)-laplacian(u2)-u1*x];
symCoeffs = pdeCoefficients(pdeeq,[u1 u2],'Symbolic',true)
Hope this helps!
참고 항목
카테고리
Help Center 및 File Exchange에서 Geometry and Mesh에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!