(MATLAB 2010 A Student version)
Question:
I am trying to solve 9 symbolic equations with 9 symbolic variables using “solve” command:
Problem:
N=2
V = sym(zeros(N+2+1)); % 5*5 symbolic matrix
syms D x; %D is diffusion constant
%Creating 3*3 non-zero symbolic entries
for row = 0:N
for col = 0:N
V(row+1, col+1) = sym(sprintf('V%d%d', row+1, col+1));
end
end
count=1;
for m=0:N
for n=0:N
% Diffusion PDE written in Differential Transform domain
eqn(count) = (m+1)*V(m+1+1,n+1)-D*(n+1)*(n+2)*V(m+1,n+2+1);
count=count+1;
end
end
%length(eqn) is 9
eqn=eqn(1:7); %as last 2 terms are [0 0] in eqn
Initial condition for PDE are given by Dirac Delta func (“delta(x)”). Thus, it is composed of 2 conditions (one for x=0 and one for x not equal to 0)
Thus, at x=0, it is “1” giving:
eqn(length(eqn)+1)=V(1,1)-V(2,1)+V(3,1)-1; % ini.condn
And at x NOT equal to 0, it is “0” giving: (does it make sense?)
eqn(length(eqn)+1)=(V(1,1)-V(2,1)+V(3,1))+(V(1,2)-V(2,2)+V(3,2))*x + (V(1,3)-
V(2,3)+V(3,3))*x^2; %ini. condn
S=solve(eqn,'V11' ,'V12' ,'V13' ,'V21' ,'V22' ,'V23' ,'V31' ,'V32' ,'V33');
Answer: S.V11, S.V12, S.V13, S.V21 are functions of ‘z’. Rest are 0
I am getting ‘z’ in my solutions.
-
What is ‘z’ in the solution? What’s the source of this?
-
How to circumvent this and get meaningful solution?
Thanks in advance
The
zparameter means for whatever value ofzyou substitute in, your set of solutions is valid for your equations.You have nine equations to find nine unknowns. However your sixth equation
2*V33=0renders the following equation-2*D*V33=0redundant…so you actually only have eight independent equations, hence the extra parameterz. I don’t know more about the details about your PDE to tell you why it isn’t well-posed, but basically you need another equation involving your nonzero variables if you expect a unique solution.