PDE Parabolic coefficient
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi !
This is the first time I use matlab, so I have a bad level.
Parabolic solver has this form:
u1=parabolic(u0,tlist,b,p,e,t,c,a,f,d)
It is said on this page (<http://www-rohan.sdsu.edu/doc/matlab/toolbox/pde/assempde.html>) that "*c*" coefficient can be a 2by2 matrix.
Here is my little code :
[p,e,t]=initmesh('squareg');
[p,e,t]=refinemesh('squareg',p,e,t);
u0=zeros(size(p,2),1);
ix=find(sqrt(p(1,:).^2+p(2,:).^2)<0.4);
u0(ix)=ones(size(ix));
tlist=linspace(0,0.1,20);
c=[1 2; 3 4];
f=10;
u1=parabolic(u0,tlist,'squareb1',p,e,t,c,0,f,1);
pdeplot(p,e,t,'xydata',u1(:,end))
Impossible to run it. I get this error message :
??? Error using ==> times
Matrix dimensions must agree.
Error in ==> pdeasmc at 18
c3=((cc1.*g1x.*g2x+cc2.*g1y.*g2y).*ar);
Error in ==> assema at 112
ks1=pdeasmc(it1,it2,it3,np,ar,x,y,sd,u,ux,uy,time,g1x,g1y,g2x,g2y,g3x,g3y,c);
Error in ==> parabolic at 85
[K,M,F]=assema(p,t,c,a,f,time);
Error in ==> ex_parab at 9
u1=parabolic(u0,tlist,'squareb1',p,e,t,c,0,f,1);
Why is there a matrix dimension problem ? I work on D=2 space, so the gradient is just a column vector, with 2 lines, and 'c' is just a 2by2 matrix in my code.
Does some can help me to understand and fixe it ? Thanks in advance !!
0 Kommentare
Akzeptierte Antwort
Bill Greene
am 18 Apr. 2012
Hi,
PDE Toolbox accepts c-matrices in many different forms depending on whether the matrix is symmetric, unsymmetric or diagonal and also whether the coefficients vary as a function of x. This is discussed more on page 5-21 of the manual.
For your scalar case with a full, unsymmetric matrix, c would be: c=[1 3 2 4]'; Note, this is 4 rows with the coefficients entered by column.
Regards,
Bill
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Eigenvalue Problems finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!