Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

New to MATLAB, Need basic help

  1. Oct 30, 2007 #1
    1. The problem statement, all variables and given/known data
    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.

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

    3. 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')
  2. jcsd
  3. Oct 30, 2007 #2


    User Avatar

    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.
  4. Oct 31, 2007 #3


    User Avatar
    Science Advisor
    Homework Helper

    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.
  5. Dec 9, 2011 #4
    Re: Please HELP me with MATLAB

    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.

    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.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook