Solving Eigenvalue problem (2nd order ODE)
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying to solve the following eigenvalue problem:
Amatrix = zeros(nz-1,nz-1);
Coeff = zeros(nz,1);
for iR = 1 : nz
Coeff(iR) = 1/N2(iR);
if isnan(Coeff(iR))
Coeff(iR)=Coeff(iR-1);
end
end
for iA = 2 : (nz-2)
Amatrix(iA,iA) = -2/(DZ(iA)*DZ(iA))*Coeff(iA);
Amatrix(iA,iA-1) = 1/(DZ(iA)*DZ(iA))*Coeff(iA);
Amatrix(iA,iA+1) = 1/(DZ(iA)*DZ(iA))*Coeff(iA);
end
Amatrix(1,1) = -2/(DZ(1)*DZ(1))*Coeff(1);
Amatrix(1,2) = 1/(DZ(1)*DZ(1))*Coeff(1);
Amatrix(nz-1,nz-1) = -2/(DZ(nz-1)*DZ(nz-1))*Coeff(nz-1);
Amatrix(nz-1,nz-2) = 1/(DZ(nz-1)*DZ(nz-1))*Coeff(nz-1);
[V,DD] = eig(full(Amatrix));
PHI = zeros(100,1);
for iz = 1 : 99
PHI(iz,1)=V(iz,1); %Selecting tthe first mode?
end
C = DD.^{-0.5}
When I execute this code, however,
does not match the theory; specifically the mode-1 (
) structure is not present (
should only have one extrema between
and
). I have included the plot below of normalized
and
for clarity.

Any advice with where I'm going wrong would be greatly appreciated. Thanks in advance for your help!
0 Kommentare
Antworten (1)
Alan Stevens
am 12 Feb. 2021
Your mathematical equation has the inverse of the eigenvalue squared, but your code calcukates the inverse of the square root of the eigenvalue. No idea if this solves your problem as you don't specify N2 or DZ, so can't run your coding.
1 Kommentar
Siehe auch
Kategorien
Mehr zu Linear Algebra finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!