How do I call a function into another file?
Show older comments
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
1 Comment
Walter Roberson
on 13 Oct 2019
k = kguess(Ws, g, H);
Answers (0)
Categories
Find more on Adding custom doc in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!