MATLAB Why Does MATLAB Show an Error When Solving Trigonometric Equations in Degrees?

  • Thread starter Thread starter SaRCaZZM
  • Start date Start date
  • Tags Tags
    Matlab
AI Thread Summary
The discussion revolves around solving a complex trigonometric equation for the variable d. The equation involves cotangent and sine functions and is set equal to -0.3939. The user encounters an error message indicating that the input is not a valid equation or expression when attempting to use the solve function. Key points of advice include ensuring proper multiplication notation by using an asterisk (*) between constants and variables, as in cot(104.789*d), and reviewing the syntax for the solve function in MATLAB, particularly the use of single quotes around the variable. Additionally, there are suggestions for generating plots and using loops in MATLAB to analyze the equation further, emphasizing the importance of proper coding practices such as clearing variables and pausing execution.
SaRCaZZM
Messages
1
Reaction score
0

Homework Statement


I need help solving for d, in the really long equation below. However, whenever I insert the following command (see below), I get 'is not a valid equation or expression', but I can't figure out why.


Homework Equations


((cot(104.789d))^2) + (((cot(104.789d))^2)*(1 + (-1.339*(10^-3)))*((sin(209.58d))^2))=-0.3939


The Attempt at a Solution


solve('((cot(104.789d))^2) + (((cot(104.789d))^2)*(1 + (-1.339*(10^-3)))*((sin(209.58d))^2))=-0.3939','d')
 
Physics news on Phys.org
SaRCaZZM said:

Homework Statement


I need help solving for d, in the really long equation below. However, whenever I insert the following command (see below), I get 'is not a valid equation or expression', but I can't figure out why.


Homework Equations


((cot(104.789d))^2) + (((cot(104.789d))^2)*(1 + (-1.339*(10^-3)))*((sin(209.58d))^2))=-0.3939


The Attempt at a Solution


solve('((cot(104.789d))^2) + (((cot(104.789d))^2)*(1 + (-1.339*(10^-3)))*((sin(209.58d))^2))=-0.3939','d')

I suppose that when you write cot(104.789d) you really mean cot(104.789*d). The same with the arguments of the other trigonometric functions.
 
I would recheck some examples of MATLAB's "solve" function. Your use of single quotes around the variable at the end of your expression, looks odd to me.
 


1
Ask the user for inputs of the variables start, stop, inc and a. At runtime please enter values of 0, 30, 0.1 and 2, respectively. Plot the equation alt = sin(pi/4) + a•(t-5)2, where a is 2 and t varies from 0 to 30 with a step size of 0.1 in a figure 2. Use an appropriate FOR loop to generate and store the values of t and alt. Add a title, xlabel and ylabel to the plot. Remember to clear at the beginning and pause at the end of the code.


2
For the same “alt” equation above, use a WHILE loop to solve for the time t (starting from 0) at which alt crosses 600 but this time use inc of 0.01 instead of 0.1. Use the command sprintf to create an output message displaying the time at which this occurs (label your answer clearly). Remember to clear at the beginning and pause at the end of the code.
 

Similar threads

Replies
5
Views
3K
Replies
4
Views
1K
Replies
4
Views
1K
Replies
2
Views
3K
Replies
1
Views
2K
Replies
5
Views
2K
Replies
10
Views
3K
Back
Top