How can I enter a source term which is a vector, to solve -div(cgradu)=F(F a vector)?
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello, I want to solve the pde (-div(cgrad(u))= F) with F given as a column vector of length N. I used the assempde to solve directly the pde with that F but it always answers me
??? Error using ==> plus Matrix dimensions must agree.
Error in ==> assempde at 245 KK=K+M+Q;
Error in ==> myprogram at 119 u=assempde(b,p,e,t,c,a,F);
Any help, please? Thank you in advance
댓글 수: 1
Walter Roberson
2013년 12월 17일
At the MATLAB command line, command
dbstop if error
and then run the program. When it stops, what does size(K), size(M), size(Q) indicate? Then, give the command
dbup
and show size(b), size(p), size(e), size(t), size(c), size(a), size(F)
답변 (2개)
Bill Greene
2013년 12월 12일
I assume N is > 1? How did you define the first argument to assempde, b? I'm guessing that the problem at line 245 of assempde is caused by K and M having a different size from Q where Q is calculated based on your boundary condition definition, b.
Bill
댓글 수: 3
Bill Greene
2013년 12월 13일
OK, well I suspect there is a problem in your pdebound function. There is no way to say more with only the information you have provided.
Bill
Bill Greene
2013년 12월 17일
Yes, your pdebound function is incorrect for a system of PDE (N>1). Specifically, as this documentation page shows,
the returned matrices must have these dimensions (for this example, N=3):
N = 3; % Set N = the number of equations
ne = size(e,2); % number of edges
qmatrix = zeros(N^2,ne);
gmatrix = zeros(N,ne);
hmatrix = zeros(N^2,2*ne);
rmatrix = zeros(N,2*ne);
I recommend taking a close look at the www page I list above so you can see exactly how those matrices must be defined.
Bill
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Boundary Conditions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!