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

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

Discussion Overview

The discussion revolves around troubleshooting an error encountered in MATLAB when attempting to solve a trigonometric equation involving the cotangent and sine functions. Participants are exploring the syntax and structure of the equation and the use of the "solve" function in MATLAB.

Discussion Character

  • Homework-related
  • Technical explanation

Main Points Raised

  • One participant presents a trigonometric equation and describes an error message received when using the "solve" function in MATLAB.
  • Another participant suggests that the issue may stem from the notation used, specifically the absence of multiplication symbols in expressions like cot(104.789d), which they interpret as cot(104.789*d).
  • A third participant questions the use of single quotes around the variable in the "solve" function, implying that this may be contributing to the error.
  • Additional posts introduce unrelated MATLAB tasks involving plotting and loops, which may not directly address the original problem but indicate a broader context of MATLAB usage.

Areas of Agreement / Disagreement

There is no consensus on the exact cause of the error, as participants have raised different potential issues without resolving the disagreement. The discussion remains open to further exploration of the problem.

Contextual Notes

Participants have not provided specific examples of successful syntax or detailed explanations of the "solve" function's requirements, leaving some assumptions unaddressed.

Who May Find This Useful

Individuals working with MATLAB, particularly those dealing with trigonometric equations and syntax issues, may find this discussion relevant.

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 ·
Replies
5
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K