필터 지우기
필터 지우기

Error "Undefined function or variable"

조회 수: 2 (최근 30일)
Shikhar Sharma
Shikhar Sharma 2019년 9월 9일
댓글: Shikhar Sharma 2019년 9월 9일
I defined a function;
function [maBar, wBar, alphaBar] = hcEqPt(vBar, c1, c2, c3, c4)
wBar = vBar/0.129;
maBar = (36.6 + 0.106*wBar + c4*(wBar^2))/c3;
alphaBar = (acos(1-(c2*wBar*maBar/c1)) + 0.0252)/ 1.14;
end
[maBar_1, wBar_1, alphaBar_1] = hcEqPt(22, 0.6, 0.095, 47500, 0.0026);
disp("At v=22, ma = %d, w = %d, alpha = %d", maBar_1, wBar_1, alphaBar_1);
When I try to use this function to obtain a values of vBar further in the script it shows an error "Undefined function or variable".
Kindly help.

답변 (1개)

madhan ravi
madhan ravi 2019년 9월 9일
[maBar_1, wBar_1, alphaBar_1] = hcEqPt(22, 0.6, 0.095, 47500, 0.0026);
fprintf('At v=22, ma = %d, w = %d, alpha = %d', maBar_1, wBar_1, alphaBar_1);
function [maBar, wBar, alphaBar] = hcEqPt(vBar, c1, c2, c3, c4)
wBar = vBar/0.129;
maBar = (36.6 + 0.106*wBar + c4*(wBar^2))/c3;
alphaBar = (acos(1-(c2*wBar*maBar/c1)) + 0.0252)/ 1.14;
end
  댓글 수: 22
madhan ravi
madhan ravi 2019년 9월 9일
편집: madhan ravi 2019년 9월 9일
Looks like you didn't give any attention to the suggestion , well done :). See the attached file.
Please again don't miss the valuable comment given by sir Walter
Shikhar Sharma
Shikhar Sharma 2019년 9월 9일
Thank you very much for your time. I am quite new to this and trying to cope up with it.
Thank you for being patient. :)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by