How do I call a function into another file?
Ältere Kommentare anzeigen
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 Kommentar
Walter Roberson
am 13 Okt. 2019
k = kguess(Ws, g, H);
Antworten (0)
Kategorien
Mehr zu Adding custom doc finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!