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
댓글 수: 1
Walter Roberson
2019년 10월 13일
k = kguess(Ws, g, H);
답변 (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!