Matlab help. Using Newton Raphson

  • Thread starter thekkid33
  • Start date
  • #1
4
0

Homework Statement


Two forces P and Q are applied at the end of a screw eye in order to remove the post.


Homework Equations


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


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; [email protected](tha) 2*p*sin(tha)*cos(30)+p*cos(tha)-800=0; [email protected](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
 

Answers and Replies

  • #2
6,054
391
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
6,054
391
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.
 

Related Threads on Matlab help. Using Newton Raphson

  • Last Post
Replies
7
Views
6K
Replies
0
Views
2K
Replies
21
Views
2K
  • Last Post
Replies
9
Views
5K
  • Last Post
Replies
20
Views
16K
Replies
1
Views
2K
  • Last Post
Replies
0
Views
2K
  • Last Post
Replies
5
Views
2K
  • Last Post
Replies
2
Views
1K
Top