+ Reply to Thread
Results 1 to 4 of 4

Vba code for newton raphson

  1. #1
    Registered User
    Join Date
    10-20-2014
    Location
    San Antonio, Tx
    MS-Off Ver
    Mac 2011
    Posts
    4

    Vba code for newton raphson

    Can somebody tell me how to write a VBA code for Newton Raphson
    The code should begin like this
    Function Newt_Raph_1 (x_initial,cc,n)




    I have the code for matlab but i cant seem to write it in VBA
    %STEP 1: Name the function and its arguments.
    function NewtRaph(x_init, cc, n)
    %STEP 2: GIVE INITIAL VALUES, and other starting information.
    x=x_init;
    %STEP 3: RUN THE LOOP.
    for i=1:n;
    x_prev=x;
    x=x-func2(x)/der_func2(x);
    if 100*abs((x-x_prev)/x_prev)<cc,break,end;
    end
    %STEP 4: REPORT RESULTS.
    disp(x)
    %STEP 5: END THE FUNCTION.
    end


    If someone could please help id appreciate it HW#6_Instructions_Fall_2014.pdf
    Attached is the problem. Number 1 part g is the problem i need help doing thanks
    Last edited by albeezy; 10-20-2014 at 12:21 AM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Vba code for newton raphson

    To suggest the obvious, have you tried googling excel vba newton raphson
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    10-20-2014
    Location
    San Antonio, Tx
    MS-Off Ver
    Mac 2011
    Posts
    4

    Re: Vba code for newton raphson

    Yes i have not been able to find what i need so i tried this to see if anyone knew anything about it

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,832

    Re: Vba code for newton raphson

    It appears that you already know the basic idea behind the NR algorithm (unless you have simply copied the Matlab code from someone else), so it should be as simple as translating each statement/block into its VBA equivalent. Are there specific statements you need help with, or are you just completely unfamiliar with VBA.

    Assuming the latter, I would suggest the following help files:
    How to use the Function() statement to define a function procedure: http://msdn.microsoft.com/en-us/libr...ice.15%29.aspx
    For...Next loops: http://msdn.microsoft.com/en-us/libr...ice.15%29.aspx

    From there, what specifically are you having trouble with?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Newton method - system of nonlinear equations
    By zyrafowaty_swiat in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-10-2014, 07:56 AM
  2. Newton's iteration for multiple rows.
    By maistral in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-02-2014, 03:00 PM
  3. Goal Seek & Newton-Raphson
    By posto5 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-07-2013, 01:49 AM
  4. request newton raphson code
    By hamidciv in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-02-2012, 03:34 PM
  5. Created VBA using Newton's Method
    By BFlick11 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-31-2010, 01:39 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1