How do I call a function into another file?

I have a function in a file called kguess.m that has this and produces the value for k
function k = kguess(w, g, h)
k = (w) / (g*sqrt(tanh((w)*h)/g));
end
But I am trying to use the ouput from the file kguess.m and plug it into equations within another file called my_function.m and I am not sure why I am getting errors. I have tried different methods but none seem to work. Could someone please help me?
g = 9.81;
H = input('Input a value for the variable H: ');
Ws = input('Input a value for the variable Ws: ');
k = [k];
for n = k:100
F = g.*k.*tanh(k.*H)-Ws;
FP = g.*(tanh(k.*H))+k.*(sech(k.*H).^2);
A = k - (F/FP);
k = k +1;
end

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Adding custom doc 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by