필터 지우기
필터 지우기

PDE Parabolic coefficient

조회 수: 2 (최근 30일)
Jonathan B.
Jonathan B. 2012년 4월 17일
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 !!

채택된 답변

Bill Greene
Bill Greene 2012년 4월 18일
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
  댓글 수: 1
Jonathan B.
Jonathan B. 2012년 4월 19일
Hi,
Thank you so much for your help, and for the manual reference !
Best regards,
Jonathan.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Eigenvalue Problems에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by