Filter löschen
Filter löschen

Error "Undefined function or variable"

2 Ansichten (letzte 30 Tage)
Shikhar Sharma
Shikhar Sharma am 9 Sep. 2019
Kommentiert: Shikhar Sharma am 9 Sep. 2019
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.

Antworten (1)

madhan ravi
madhan ravi am 9 Sep. 2019
[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 Kommentare
madhan ravi
madhan ravi am 9 Sep. 2019
Bearbeitet: madhan ravi am 9 Sep. 2019
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 am 9 Sep. 2019
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. :)

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by