AnimeGalleries [dot] NetAnimeWallpapers [dot] ComAnimeLyrics [dot] ComAnimePedia [dot] ComAnimeGlobe [dot] Com

User Tag List

+ Reply to Thread
Results 1 to 2 of 2

Thread: Bisection Method for Engineering Beam Problems - Matlab

  1. #1
    Member kotov9syndrome is on a distinguished road kotov9syndrome's Avatar
    Gil
    1,443.05
    Gender
    My Mood
    Mellow
    Gifts 007 - Squirtle
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Latest Post
    07-31-2014 08:42 AM
    User Info Thanks / Tagging Info Gifts / Achievements / Awards vBActivity Stats
    Join Date
    Mar 2014
    Location
    Maryland, USA
    Threads
    8
    Posts
    61
    Blog Entries
    2
    Rep Power
    1
    Gamer IDs

    PSN ID: kotov9syndrome Steam ID: kotov9syndrome

    Default Bisection Method for Engineering Beam Problems - Matlab

    Does anyone know how to use matlab to do bisection methods for numerical methods???

    Please help.

  2. #2
    Senior Member nslay has much to be proud of nslay has much to be proud of nslay has much to be proud of nslay has much to be proud of nslay has much to be proud of nslay has much to be proud of nslay has much to be proud of nslay has much to be proud of nslay has much to be proud of nslay has much to be proud of nslay's Avatar
    Gil
    198,964.31
    Gender
    Gifts Chicken Glasses Red Glasses Red
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Latest Post
    06-08-2014 10:24 AM
    User Info Thanks / Tagging Info Gifts / Achievements / Awards vBActivity Stats
    Join Date
    Sep 2012
    Threads
    3
    Posts
    174
    Rep Power
    17

    Default Re: Bisection Method for Engineering Beam Problems - Matlab

    Quote Originally Posted by kotov9syndrome View Post
    Does anyone know how to use matlab to do bisection methods for numerical methods???

    Please help.
    [s]Which do you understand the least? The theory behind the bisection method, or the matlab scripting?[/s]

    EDIT:
    Matlab might have a better root solver than bisection. Here's my octave implementation

    Code:
    function [x,nsteps] = bisect(func,a,b,epsilon)
    
    funcstr = ['y=',func,';'];
    
    x = a;
    eval(funcstr);
    ya = y;
    
    x = b;
    eval(funcstr);
    yb = y;
    
    % Does it satisfy the intermediate value theorem?
    if (ya > 0 & yb > 0) | (ya < 0 & yb < 0)
            % Nope
            nsteps = -1;
            return;
    end
    
    % From mathworld
    nsteps = ceil(log2(b-a)-log2(epsilon));
    
    for i=1:nsteps
            mid = 0.5*(a+b);
    
            x = mid;
            eval(funcstr);
            ymid = y;
    
            % Does the first bisected interval satisfy the intermediate value theorem?
            if (ymid > 0 & ya < 0) | (ymid < 0 & ya > 0)
                    b = mid;
                    yb = ymid;
            else
                    % Nope, so it must be the second interval
                    a = mid;
                    ya = ymid;
            end
    end
    
    x = 0.5*(a+b);
    Example use:
    Code:
    octave-3.2.4.exe:30> [y,nsteps] = bisect("x^2-2",1,2,1e-16)
    y =  1.4142
    nsteps =  54
    octave-3.2.4.exe:31> [y,nsteps] = bisect("x^2-2",2,5,1e-16)
    y =  5
    nsteps = -1
    You may have to tweak it a little for Matlab.
    Last edited by nslay; 03-10-2014 at 08:45 PM.

+ 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. Genetic Engineering
    By Ericgamer1 in forum Miscellaneous Miscellany
    Replies: 13
    Last Post: 09-05-2010, 07:56 AM
  2. Anime and Engineering
    By Unwed transient in forum Introductions
    Replies: 17
    Last Post: 03-19-2009, 10:33 PM
  3. Double-Beam Sword Gundam?
    By Arvin in forum Gundam
    Replies: 3
    Last Post: 12-18-2008, 06:30 PM
  4. Beam tutorial
    By IchigoKiss in forum Tutorials
    Replies: 1
    Last Post: 04-19-2008, 10:36 AM
  5. Breast Fire VS Getta Beam
    By Nineteenth in forum Mecha and Apocalyptic Anime & Manga
    Replies: 4
    Last Post: 07-01-2006, 09:32 AM

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