Code covered by the BSD License  

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Nonlinear Finite Difference Method

5.0 | 3 ratings Rate this file 18 Downloads (last 30 days) File Size: 3.99 KB File ID: #26358 Version: 1.0
image thumbnail

Nonlinear Finite Difference Method



The Finite Difference Method is employed for solving a nonlinear boundary value problem.

| Watch this File

File Information

The function nonlinearBVP_FDM .m is an implementation of the
nonlinear finite difference method for the general nonlinear
boundary-value problem ---------------------------------------------
      y''=f(x,y,y'), for a<x<b where y(a)=alpha and y(b)=beta.
The interval [a,b] is divided into (N+1) equal subintervals
with endpoints at x(i)=a+i*h for i=0,1,2,...,N+1.
The function f should be defined as an m-file.
There is NO need for partial derivatives of f
See given example
Solve the nonlinear boundary value problem
y''=(1/8)*(32+2x^3-yy'), for 1<x<3, where y(1)=17 and y(3)=43/3
Step 1...
Create the function f as a separate m-file and save it in the
current working directory.
function f = f(x,y,yp)
f = (1/8)*(32+2*x^3-y*yp); %Note that yp=y'
Step 2...
In the command window type
>> Y = nonlinearBVP_FDM(1,3,17,43/3);
Note that Y(:,1) represents x and Y(:,2) is vector y(x)
The solution is then plotted in a new figure
If the exact solution is given, plot it for comparison
>> yexact = (Y(:,1)).^2+16./Y(:,1); plot(Y(:,1),yexact,'c')

Required Products Optimization Toolbox
MATLAB release MATLAB 7.7 (R2008b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (5)
24 May 2016 Chen Yu-Lin  
05 Apr 2016 Hongwei Guo  
10 Jun 2014 BGU

BGU (view profile)

08 Aug 2011 Mohsin Shah

im looking for any one who help me writing Matlab code pulse propagation in optical fiber using the nonlinear schrodinger equation by the help of FDTD method. please reply if there is anyone

Comment only
19 May 2011 so far

so far (view profile)

Hi all..
I'm looking for anyone who can rewrite(revise) my matlab program to solve pdes(continuity,momentum,energy)in three Dimensions...please I need serious help...

Comment only

Contact us