5.0

5.0 | 2 ratings Rate this file 163 downloads (last 30 days) File Size: 2.37 KB File ID: #24967

Newton Raphson method for transcendental equations

by Abhishek Basu

 

09 Aug 2009 (Updated 21 Aug 2009)

Code covered by the BSD License  

This file computes roots of a given trancendental equation using the Newton-Raphson method.

Download Now | Watch this File

File Information
Description

This m-file can be used to compute the root of any trascendental equation using the Newton-Raphson iterative method. The user defined parameters are the function itself, the initial point, the maximum number of permissible iterations and the error (tolerance).

Required Products Symbolic Math Toolbox
MATLAB release MATLAB 7.1.0 (R14SP3)
Zip File Content  
Other Files License.txt,
license.txt,
newton_raphson.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (7)
14 Aug 2009 Abhishek Basu  
18 Aug 2009 Abhishek Basu

I'd appreciate constructive suggestions about this code. I think the file could have been even more concise and resource efficient, so I'm looking forward to suggestions regarding what constructs might have made this submission even more useful. Feel free to drop in your ideas, and I'll try to incorporate them in my future works. Regards!

20 Aug 2009 Abhishek Basu

I received a mail from Mohd. Shahrir Mohd. Sani today. He was seeking a solution to this problem: cosh(x)*cos(x) +1 = 0. It appears that the solution obtained from this program in this particular case isn't very accurate. The code seems to be working properly for most other functions.

20 Aug 2009 Matt Fig

Three comments.

1. I do not see where you mention that this file needs the symbolic toolbox to run. It does. I wouldn't have downloaded it if I had known that because I don't have the symbolic toolbox. You should update the description to reflect this requirement.

2. Rating your own files is not good behavior. Everyone expects that an author likes his own files or he wouldn't have submitted them. Please don't try to trick people into thinking your file is esteemed by the community. Let others rate your files, then your skills and file quality can grow, and people looking for a quality file won't be misled by false ratings.

3. A numerical alternative that works for Shahrir's problem is:
f = @(x) cosh(x).*cos(x) + 1;
rt = newtzero(f); % Found on the File Exchange.
x = -8:.1:8;
plot(x,f(x),'b',rt,f(rt),'*r')

21 Aug 2009 Abhishek Basu

Thanks for your feedback Matt. I hadn't noticed that the symbolic toolbox is necessary because my version of MatLab has most of the toolboxes installed. I'll update the description as you've pointed out. I'm a bit embarrassed by the self rating part, I was expecting a more active participation from the FEX community regarding comments and rating, which I didn't, so I made a rash move.

24 Aug 2009 Erdal Bizkevelci  
05 Oct 2009 Chandan

Dear Mr. Basu

In the code you have directly computed the differential of a function with the help of MATLAB function,but how would you tackle cases when this differential becomes Zero. I hope that your code must incorporate ways to throw an exception error on your own or compute differential any other way. Infinite cycle is also a problem in certain cases. I suggest you incorporate some of the techniques to make this code more worthwhile.
Regards,

Please login to add a comment or rating.
Updates
21 Aug 2009

This program needs the MatLab Symbolic Math Toolbox to be installed in your system before you run it. Thanks to Matt for pointing that out.

Tag Activity for this File
Tag Applied By Date/Time
mathematics Abhishek Basu 10 Aug 2009 11:51:30
optimization Abhishek Basu 10 Aug 2009 11:51:30
newton raphson Abhishek Basu 10 Aug 2009 11:51:30
transcendental equation Abhishek Basu 10 Aug 2009 11:51:30
numerical methods Abhishek Basu 10 Aug 2009 11:51:30
self_rating Matt Fig 14 Aug 2009 23:43:36
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com