null(Matrix) returns an empty vector
Show older comments
I can't get the null space of a Matrix. This is how the matrix is calculated (use values Ta_in=3000, k_in=3, inputnumber=1 as reference):
function Mat = Matrix(Ta_in,k_in,inputnumber)
syms zeta(x) Psi(x) V(x) ypsilon0(x) sigma k Ta ypsilon0 Dypsilon0 mu
Ta=Ta_in;
k=k_in;
number=inputnumber;
mu_vec=[0,0,0,0,0.5,1];
mu=mu_vec(number);
ypsilon0(x)=1/(2*sigma+sigma^2)*((-1-sigma*x)+(1+sigma)^2/(1+sigma*x)+mu*(1+sigma)^2*(1+sigma*x-1/(1+sigma*x)));
ypsilon0_0=limit(ypsilon0(x),sigma,0);
Dypsilon0_0=limit(diff(ypsilon0(x),x),sigma,0);
sigma_vec=[0,0.5,1,2,0,0];
sigma=sigma_vec(number);
if sigma==0
ypsilon0=ypsilon0_0;
Dypsilon0=Dypsilon0_0;
else
ypsilon0=ypsilon0(x);
Dypsilon0=diff(ypsilon0,x,1);
end
ypsilon0=subs(ypsilon0);
Dypsilon0=subs(Dypsilon0);
gamma=0;
eqs=[zeta(x)==1/(1+sigma*x)*(diff(Psi(x),x,2)-k^2*Psi(x))-sigma*diff(Psi(x),x,1)/(1+sigma*x)^2,...
gamma*zeta(x)-Ta*2*ypsilon0*k*V(x)/(1+sigma*x)==diff(zeta(x),x,2)+sigma*diff(zeta(x),x,1)/(1+sigma*x)-(k^2+sigma^2/(1+sigma*x)^2)*zeta(x),...
gamma*V(x)-k*Psi(x)*Dypsilon0+sigma*ypsilon0/(1+sigma*x)/(1+sigma*x)==diff(V(x),x,2)+sigma/(1+sigma*x)*diff(V(x),x,1)-(k^2+sigma^2/(1+sigma*x)^2)*V(x)];
vars=[zeta(x), Psi(x), V(x)];
[newEqs,newVars]=reduceDifferentialOrder(eqs,vars);
newEqs=subs(newEqs);
xystruct=struct('x',[],'y',[]);
f=zeros(3,3);
for n=1:3
switch n
case 1
c=[1 0 0];
case 2
c=[0 1 0];
case 3
c=[0 0 1];
end
%%initial conditions:
Psi0=0;
DPsi0=0;
zeta0=c(1);
Dzeta0=c(2);
V0=0;
DV0=c(3);
%%order: newVars =zeta(x), Psi(x), V(x), Dzeta_t(x), DPsit(x), DVt(x)
initConditions=[zeta0 Psi0 V0 Dzeta0 DPsi0 DV0];
[M,F]=massMatrixForm(newEqs,newVars);
fun = M\F;
odefun=odeFunction(fun,newVars);
opts = odeset('RelTol',1e-5,'AbsTol',1e-7);
[x,y]=ode45(odefun,[0 1], initConditions,opts);
xystruct(n).x=x;
xystruct(n).y=y;
[rows,cols]=size(y);
f(1,n)=y(rows,2);%%f1 = psi
f(2,n)=y(rows,5);%%f2 = Dpsi
f(3,n)=y(rows,3);%%f3 = V
end
Mat=f;
Then:
null(Matrix(3000,3,1))
This returns an empty vector.
Any ideas how to solve this issue?
Accepted Answer
More Answers (0)
Categories
Find more on Linear Algebra 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!