How can I enter a source term which is a vector, to solve -div(cgradu)=F(F a vector)?
3 views (last 30 days)
Show older comments
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 Comment
Walter Roberson
on 17 Dec 2013
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)
Answers (2)
Bill Greene
on 12 Dec 2013
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 Comments
Bill Greene
on 13 Dec 2013
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
on 17 Dec 2013
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 Comments
See Also
Categories
Find more on Boundary Conditions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!