Problems with solving a PDE system of 3 parabolic equations

4 views (last 30 days)
Hi,
I'm beginner in using the PDE toolbox and I get an error message as I'm trying to execute the attached code. The error message is the following:
Error using .* Matrix dimensions must agree.
Error in pdeasma (line 8)
aod=a.*ar/12; % Off diagonal element
Error in pde.internal.assema2DImpl (line 184)
km1=pdeasma(it1,it2,it3,np,ar,x,y,sd,u,ux,uy,time,a);
Error in pde.PDEModel/assema (line 51)
[ks,km,fm] = pde.internal.assema2DImpl(pdebc, p, t, c, a, f, varargin{idxstart:end});
Error in pdeODEInfo/getMats (line 163)
[~,MM]=self.thePde.assema(self.p,self.t,0,self.d,self.f,u,time);
Error in pdeODEInfo/checkFuncDepen (line 61)
[MM0,K0,M0,F0,Q0,G0,H0,R0] = self.getMats(u0, t0);
Error in pdeParabolicInfo (line 13)
obj=obj.checkFuncDepen(u0, tlist);
Error in parabolic (line 109)
pdeprb=pdeParabolicInfo(u0,tlist,b,p,e,t,c,a,f,d);
Error in test_illumination2 (line 78)
u = parabolic(u0,tlist,model,c,a,f,d);
Any idea where this comes from? I guess that one of my matrices is probably too small. Thanks for helping me!
Best regards,
Kai

Answers (1)

Alan Weiss
Alan Weiss on 8 May 2015
It is possible that you gave a PDE coefficient incorrectly. How did you specify your coefficients? Through a matrix? A string? The possible forms of coefficients is described here.
If this does not help, then please give us your coefficient specifications so we can check for errors.
Alan Weiss
MATLAB mathematical toolbox documentation
  2 Comments
Kai
Kai on 8 May 2015
Hi Alan, thanks for the answer. The coefficients are defined as a string, exept of the coefficients a and d. Please also look into the attached code! I wanted to solve a PDE system of three coupled parabolic pde´s.
%define coefficients d=[0,0,0,0,-q,0,0,0,+q]; a=[0,0,0,-q,0,0,q,0,0]; eps_s=num2str(eps); c1=[num2str(q*mu_n),'*u(2)']; %q*mu_n*n c2=num2str(-q*mu_n*V_T); %-q*mu_n*V_T c3=[num2str(q*mu_p),'*u(3)']; %q*mu_p*p c4=num2str(q*mu_p*V_T); %q*mu_p*V_T %c-Matrix --> 4N^2 elements --> 36 elements c=char(eps_s,'0','0',eps_s,c1,'0','0',c1,c3,'0','0',c3,'0','0','0','0',c2,'0','0',c2,'0','0','0','0','0','0','0','0','0','0','0','0',c4,'0','0',c4); %f elements f1=num2str(-q*(N_D-N_A)); f2=[num2str(q),'*(u(3)*u(2)',num2str(-n_i),')/(',num2str(t_p),'*(u(2)+',num2str(n_i),')+',num2str(t_n),'*(u(3)+',num2str(n_i),'))','-',num2str(alpha*phi_0*q),'*exp(-',num2str(alpha),'*y)']; f3=[num2str(-q),'*(u(3)*u(2)',num2str(-n_i),')/(',num2str(t_p),'*(u(2)+',num2str(n_i),')+',num2str(t_n),'*(u(3)+',num2str(n_i),'))','+',num2str(alpha*phi_0*q),'*exp(-',num2str(alpha),'*y)']; f=char(f1,f2,f3);
Alan Weiss
Alan Weiss on 13 May 2015
I am sorry, but I cannot read your coefficients. Please format them using the {} Code button.
Alan Weiss
MATLAB mathematical toolbox documentation

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!