Error with system of parabolic pdes
Show older comments
Hi I am trying to solve the equations du/dt=-a1*u + f(u,v), dv/dt=-a2*v + g(u,v)
For simplicity, I now just take f and g as scalars
However I get the error message
Error using .* Matrix dimensions must agree.
Error in pdeasma (line 9) aod=a.*ar/12; % Off diagonal element
Error in assema (line 189) km1=pdeasma(it1,it2,it3,np,ar,x,y,sd,u,ux,uy,time,a(k,:));
Error in parabolic (line 84) [unused,MM]=assema(p,t,0,d,f,time);
Error in twoDpdex4 (line 26) u1=parabolic(u0,tlist,'squareb1',p,e,t,c,a,f,d);
The code is
c=zeros(2,2,2,2);
a=[-a1 0; 0 -a2];
d=[1 0; 0 1];
f=[1;2];
[p,e,t]=initmesh('squareg');
u0=zeros(size(p,2),2);
ix=find(sqrt(p(1,:).^2+p(2,:).^2)<0.4);
u0(ix,1)=0.1*ones(size(ix));
u0(ix,2)=0.2*ones(size(ix));
tlist=linspace(0,0.05,10);
u1=parabolic(u0,tlist,'squareb1',p,e,t,c,a,f,d);
Thank you in advance for your help and advice
Accepted Answer
More Answers (2)
Bill Greene
on 16 May 2013
Hi,
You've run into a PDE Toolbox bug that has been fixed for several releases. Is there any possibility that you can upgrade to the latest version of MATLAB (R2013a)?
If you are able to upgrade, a couple of small changes in your fcoeffunction will get this working. First, these two lines should be removed:
uintrp = reshape(uintrp,[],N); % matrix with N column
uintrp = uintrp'; % change to row vectors
Then, this line
f(2,:) = 1 + tanh(ux(1,:)) + tanh(uy(3,:));
is referring to uy(3,:) which doesn't exist for a 2-equation system.
Regards,
Bill
Bill Greene
on 16 May 2013
0 votes
I should have also mentioned that the functionality to have coefficients that are functions of the solution (or gradients) in the parabolic function was a new capability in PDE Toolbox R2012b. So, if you are relying on that capability, you will need to upgrade to at least R2012b.
Bill
Categories
Find more on Eigenvalue Problems 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!