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!