Results 1 to 3 of 3

Math Help - Matlab function and matrices help

  1. #1
    Newbie
    Joined
    May 2010
    Posts
    2

    Matlab function and matrices help

    Hi,

    I am trying to write a function that caculates the speed of sound and characteristic impedance by taking data from a matrix then adds the values as extra columns to the matrix. so far i have this:


    function
    [modarray, c, Y]=speed(h)

    K = h(:,3)+273;
    S = h(:,2);

    c = sqrt(1.4*287*K);

    Y = c/S;


    modarray = h

    end
    I get an Input argument "h" is undefined error when i try to run the function. How do i fix that?

    Also im not sure how to add the values onto the matrix. Could anyone give me a nudge in the right direction please?

    Thanks Rhys
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Newbie
    Joined
    May 2010
    Posts
    2
    ok so ive worked the undefined arguement problem ou i was just being stupid but now the outputs arent getting saved as variables
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by repta View Post
    ok so ive worked the undefined arguement problem ou i was just being stupid but now the outputs arent getting saved as variables
    Is your calling statement:

    >[modarray, c, Y]=speed(h);

    CB
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 12
    Last Post: December 2nd 2011, 12:02 PM
  2. How to program this in matlab or python: matrices
    Posted in the Math Software Forum
    Replies: 0
    Last Post: April 19th 2011, 08:02 AM
  3. Matlab help wwith matrices
    Posted in the Math Software Forum
    Replies: 1
    Last Post: July 5th 2010, 10:31 PM
  4. Replies: 0
    Last Post: March 29th 2010, 05:47 AM
  5. matlab matrices code - urgent
    Posted in the Math Software Forum
    Replies: 0
    Last Post: November 22nd 2009, 09:00 AM

Search Tags


/mathhelpforum @mathhelpforum