MATLAB basics ----------- methods for solving the edge Value Problem of ordinary differential equations using Matlab

Source: Internet
Author: User

Algorithm code

Solinit = bvpinit (linspace (, 5), [1 0]); % linspace (, 5) is the initial mesh, [] is the initial estimated value Sol = bvp4c (@ twoode, @ twobc, solinit); % twoode and twobc are the functions of the differential equation and the boundary condition, respectively, solinit is structured X = linspace (); % determines the X range y = Deval (sol, x); % determines the y range plot (X, Y (1 ,:)); % plot the graph % of Y-X to define the twoode function (the following code is saved as the twoode in the working directory. M file) function dydx = twoode (x, y) % differential equation Function Definition dydx = [Y (2)-ABS (Y (1)]; % defines the twobc function (the following code is saved as the twobc in the working directory. M file) function res = twobc (ya, Yb); % definition of the boundary condition function res = [ya (1); Yb (1) + 2];

Result


MATLAB basics ----------- methods for solving the edge Value Problem of ordinary differential equations using Matlab

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.