Insights Blog
-- Browse All Articles --
Physics Articles
Physics Tutorials
Physics Guides
Physics FAQ
Math Articles
Math Tutorials
Math Guides
Math FAQ
Education Articles
Education Guides
Bio/Chem Articles
Technology Guides
Computer Science Tutorials
Forums
General Math
Calculus
Differential Equations
Topology and Analysis
Linear and Abstract Algebra
Differential Geometry
Set Theory, Logic, Probability, Statistics
MATLAB, Maple, Mathematica, LaTeX
Trending
Featured Threads
Log in
Register
What's new
Search
Search
Search titles only
By:
General Math
Calculus
Differential Equations
Topology and Analysis
Linear and Abstract Algebra
Differential Geometry
Set Theory, Logic, Probability, Statistics
MATLAB, Maple, Mathematica, LaTeX
Menu
Log in
Register
Navigation
More options
Contact us
Close Menu
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Forums
Mathematics
MATLAB, Maple, Mathematica, LaTeX
Use finite difference method to solve for eigenvalue E in Matlab
Reply to thread
Message
[QUOTE="EigenCake, post: 4186203, member: 358400"] Use finite difference method to solve for eigenvalue E from the following second order ODE: - y'' + (x[SUP]2[/SUP]/4) y = E y I discretize the equation so that it becomes y[SUB]i-1[/SUB] - [2 + h[SUP]2[/SUP](x[SUP]2[/SUP][SUB]i[/SUB]/4)] y[SUB]i[/SUB] + y[SUB]i+1[/SUB] = - E h[SUP]2[/SUP] y[SUB]i[/SUB] where x[SUB]i[/SUB] = i*h, and h is the distance between any two adjacent mesh points. This is my code: [CODE]clear all n = 27; h = 1/(n+1); voffdiag = ones(n-1,1); for i = 1:n xi(i) = i*h; end mymat = -2*eye(n)-diag(((xi.^2).*(h^2)./4),0)+diag(voffdiag,1)+diag(voffdiag,-1); D=sort(eig(mymat),'descend'); lam= -D/(h^2); spy(mymat) fprintf(1,' The smallest eigenvalue is %g \n',lam(1)); fprintf(1,' The second smallest eigenvalue is %g \n',lam(2)); fprintf(1,' The 3rd eigenvalue is %g \n',lam(3)); [/CODE] it returns [CODE] The smallest eigenvalue is 9.92985 The second smallest eigenvalue is 39.3932 The 3rd eigenvalue is 88.0729 [/CODE] Obviously, something wrong here, since the analytic solution should be E = n + 1/2 (for n = 0, 1, 2, 3...) The smallest eigenvalue should be 0.5, instead of 9.92985. I don't know whether my numerical solution agrees with the analytic solution or not, if I impose a boundary condition (ie. when x goes to infinity, y(x) should vanish to 0). And I don't know how to impose boundary condition. Please help, thank you very much! By the way, is there any another way to find the eigenvalue E please? [/QUOTE]
Insert quotes…
Post reply
Forums
Mathematics
MATLAB, Maple, Mathematica, LaTeX
Use finite difference method to solve for eigenvalue E in Matlab
Back
Top