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:

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

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

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