Solve Theta: v^2/r=U*g*cos(theta)-g*sin(theta)

  • Context: MATLAB 
  • Thread starter Thread starter hani92
  • Start date Start date
  • Tags Tags
    Matlab
Click For Summary

Discussion Overview

The discussion revolves around solving the equation v^2/r = U*g*cos(theta) - g*sin(theta) for the variable theta using MATLAB. Participants explore methods for finding theta, including symbolic solving and algebraic manipulation, while addressing issues related to complex solutions and the interpretation of results.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Homework-related

Main Points Raised

  • One participant encounters errors in MATLAB when attempting to solve for theta and seeks assistance.
  • Another participant suggests using the solve function in MATLAB with the correct syntax for symbolic variables.
  • A later reply indicates that the initial attempt was successful in avoiding errors but did not yield a real solution for theta, prompting further inquiry.
  • One participant provides four potential solutions for theta derived from the equation but emphasizes the need to verify their validity based on the coefficients used.
  • Concerns are raised about the presence of complex solutions, with one participant noting that the results included imaginary components, suggesting that no real solution exists with the given coefficients.
  • Another participant proposes plotting the function to visually assess whether it intersects the value of v^2/r for real values of theta.
  • One participant introduces an algebraic approach to rewrite the equation in terms of R and alpha, suggesting a method to compute theta without relying on MATLAB.

Areas of Agreement / Disagreement

Participants express uncertainty regarding the existence of real solutions for theta, with some suggesting that complex solutions may arise depending on the coefficients. There is no consensus on the validity of the solutions presented or the best approach to take.

Contextual Notes

Participants mention the importance of checking the validity of solutions in the context of trigonometric functions and the implications of using complex numbers in their calculations. The discussion highlights the need for careful consideration of the coefficients involved.

hani92
Messages
3
Reaction score
0
i am trying to type in a function to find theta, but MATLAB keeps saying (The expression to the left of the equals sign is not a valid target for an assignment.) or (is not a valid expression or
equation.) the equation I'm trying to compute to get theta is :
v^2/r=U*g*cos(theta)-g*sin(theta)

v=1.8 ; r=0.3 ; U=0.2 ; g=9.81
i am trying to find theta
i would really appreciate the help
 
Physics news on Phys.org
it seems like it worked the way u said, but i had to add the syms command before for MATLAB to know what i am trying to get. when i call the function it seems like it worked it doesn't return any errors, but it doesn't give me an answer. any ideas that can help?
 
I only gave you a pointer to the use of solve and hoped that might be enough for you to use that web page to see what you needed to do.

If I do not use your constants for the coefficients I find four solutions-arccos((g*r*U^2*v^2-sqrt(g^2*r^2*U^2*(g^2*r^2*(1+U^2)-v^4)))/(g^2*r^2*(U+U^3))),
-arccos((g*r*U^2*v^2+sqrt(g^2*r^2*U^2*(g^2*r^2*(1+U^2)-v^4)))/(g^2*r^2*(U+U^3))),
arccos((g*r*U^2*v^2-sqrt(g^2*r^2*U^2*(g^2*r^2*(1+U^2)-v^4)))/(g^2*r^2*(U+U^3))),
arccos((g*r*U^2*v^2+sqrt(g^2*r^2*U^2*(g^2*r^2*(1+U^2)-v^4)))/(g^2*r^2*(U+U^3)))

But when you are dealing with things like sin and cos you always have to think about whether each of these is a correct solution, depending on the values of your coefficients and whether there are more solutions.

If I plug in your coefficients then I find

-1.37340 - 0.396247*i
-1.37340 + 0.396247*i

with all the same concerns about checking this and other possible solutions.

See if you can use the help system and Google searches to learn how you can do this and will be able to use that in the future.
 
so what does the i variable represent?
 
http://www.mathworks.com/help/techdoc/ref/i.html

That means that I did not find a real number for theta that solved your equation with the coefficients that you have, unless I made a mistake.

You can also plot U*g*cos(theta)-g*sin(theta) for -2*pi<theta<2*pi and see if it ever reaches a value of v^2/r for real values of theta. I don't think it does.

You may have not yet learned about complex numbers and you may not have learned about trig functions using complex numbers. If not then there are always new things to learn in mathematics. If you are not going to be using complex numbers for this problem, and that is certainly possible, then that plot may be the simplest way to really see if there are solutions or not or perhaps if there might be an error in one of the numbers you have.
 
Last edited:
You can to this algebraically:
Your left hand side is of the form:
[tex] a\sin\theta +b\cos\theta[/tex]
This can be written in the form:
[tex] a\sin\theta +b\cos\theta =R\sin (\theta +\alpha )[/tex]
For some [itex]R[/itex] and [itex]\alpha[/itex], so expand the RHS of the above equation and compare the coefficients of [itex]\sin\theta[/itex] and [itex]\cos\theta[/itex] to obtain:
[tex] R\sin (\theta +\alpha )=R\sin\theta\cos\alpha +R\cos\theta\sin\alpha[/tex]
So [itex]a=R\cos\alpha[/itex] and [itex]b=R\sin\alpha[/itex] and so we can see that:
[tex] R=\sqrt{a^{2}+b^{2}},\quad \tan\alpha =\frac{b}{a}[/tex]
So now you can compute [itex]\theta[/itex] with ease and you don't have to use MATLAB to solve equations for you.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K
Replies
4
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 32 ·
2
Replies
32
Views
3K