1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matlab help. Using Newton Raphson

  1. Sep 18, 2013 #1
    1. The problem statement, all variables and given/known data
    Two forces P and Q are applied at the end of a screw eye in order to remove the post.


    2. Relevant equations
    The two equations that were found are
    1.) Q*sin(30)-P*sin(θ)=0
    2.) Q*cos(30)+P*cos(θ)-800=0


    3. The attempt at a solution
    I combined the 2 equations by first solving (1) in terms of Q=2*P*sin(θ)
    then plugged into equation (2) (2*P*sin(θ))*cos(30)+P*cos(θ)-800=0
    then got f(θ)=sin(θ)*(√3)*P+P*cos(θ)-800=0
    wanted f(θ)=0 as final equation
    f'(θ)=P*(2*cos(30)*cos(θ)-sin(θ) (i do not think this is correct though)

    Then I have to write a newton raphson for θ for a given P and solve for θ.
    use P=400 to 800 with ΔP=25.
    compute θ for each P
    once θ is found for each P use equation (1) to find Q
    Now plot P and Q for each θ.

    I am very new to Matlab. (only introduced to it 2 weeks ago) and i am not to sure how to start. This is what i came up with but it is very confusing to me.

    x0=400; n=16; eps=0.001; fun=@(tha) 2*p*sin(tha)*cos(30)+p*cos(tha)-800=0; fund=@(x) p*(2*cos(30)*cos(x)-sin(x); nr=(x0,n,eps,fun,fund)
    function nr(x0, n, eps, f, fd)
    func=f(x0); dfunc=fd(x0);
    for i=400:n
    x=x0-func/dfunc;
    fprintf ('%4d %8.4f %8.4f %8.4f\n',i,func, dfunc, x)
    func=f(x); dfunc=fd(x);
    if abs(x-x0) < eps , break, end
    x0=x;
    end

    **i know there needs to be an M-File for this set up but i am not sure how to do that either.

    Thanks in advance for the help
     
  2. jcsd
  3. Sep 18, 2013 #2
    I know nothing about about Matlab, but I know that this problem can be solved with a bit of simple trigonometry.

    Are you supposed to use Newston-Raphson and Matlab to solve this?
     
  4. Sep 18, 2013 #3
    yes i am
     
  5. Sep 18, 2013 #4
    Well, in that case I should say that ##f(\theta)## and ##f'(\theta)## seem correct (except you need to slap a closing bracket onto the latter).

    What does not look right, though, is that the functions you define in the program have p in them, yet p is not defined anywhere, nor is it passed as a parameter to them. I think there is some confusion between p and the functions' x/theta argument.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Matlab help. Using Newton Raphson
  1. Newton-Raphson help! (Replies: 7)

Loading...