Matlab function and matrices help

May 2010
2
0
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
 
May 2010
2
0
ok so ive worked the undefined arguement problem ou i was just being stupid but now the outputs arent getting saved as variables
 

CaptainBlack

MHF Hall of Fame
Nov 2005
14,972
5,271
someplace
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