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

Matlab help please!

  1. Aug 10, 2009 #1
    I'm trying to solve the following problem using a matlab script but I keep getting an error:

    Show on the same axes the maximum height and horizontal distance travelled for an object thrown at a speed of 10ms-1 at an angle ranging from 0 to π/2. Equation for distance & height are:

    D= v2/g sin(2θ)

    h= (v2/2g) sin2θ

    g=9.81.

    This is my code:

    Code (Text):
    g=9.81; v=10;
    t=pi/2;
    D=(v^2/g)*sin(2*t);
    h=(v^2/(2*g))*(sin(t)).^2;
    end
    plot([0:t],D,'b',[0:t],y,'*')
    legend('horizontal distance','maximum height')
    When I run this code the graph doesn't come up and I get the following error:

    Any help here is very much appreciated. :smile:
     
  2. jcsd
  3. Aug 10, 2009 #2
    There is an "end" but nothing is started e.g. "if, while" etc. Also you did not define variable "y"

    Code (Text):

    g=9.81; v=10;
    t=0:0.1:pi/2;
    D=(v^2/g)*sin(2*t);
    h=(v^2/(2*g))*(sin(t)).^2;
    plot(t,D,'b',t,h,'*')
    legend('horizontal distance','maximum height')
     
    This should work...
     
  4. Aug 10, 2009 #3
    Pls help me..
    what are the preprocessing steps to be performed on a speech (wav file)signal in order to extract the fundamental frequency accurately?
     
  5. Aug 10, 2009 #4
    Thank you so much Trambolin, it worked! :smile:
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Matlab help please!
  1. Matlab help please (Replies: 2)

  2. Help in MATLAB please (Replies: 1)

  3. Help in MATLAB please (Replies: 22)

  4. Matlab Help please (Replies: 4)

Loading...