Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jul 2012
    Location
    Cape Town
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    simple matlab program (code)

    hi everybody!

    i'm completely new at programming and am really stuck with this program i have to make in matlab :/. I'm supposed to find the solution to an equation using the bisection method, and for some unknown reason my code just doesn't work D:

    can anyone please help me understand what's wrong?

    a=1.5
    b=0.1
    n =1
    while n < 100
    c= (a + b)/2
    y= 1/sqrt(4-c^2) + 1/sqrt(9-c^2) - 1
    if y<0
    a=c;
    else
    b=c;
    end
    n = n + 1

    end

  • #2
    New Coder
    Join Date
    Jul 2012
    Location
    Philippines
    Posts
    35
    Thanks
    5
    Thanked 0 Times in 0 Posts
    what error do you get?

  • #3
    New Coder
    Join Date
    Jul 2012
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Can you explain more detail, what's your problem with above code? If you give some detail of your error, maybe I can help you to solve.


  •  

    Posting Permissions

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