Azzera filtri
Azzera filtri

Error "Undefined function or variable"

2 visualizzazioni (ultimi 30 giorni)
Shikhar Sharma
Shikhar Sharma il 9 Set 2019
Commentato: Shikhar Sharma il 9 Set 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.

Risposte (1)

madhan ravi
madhan ravi il 9 Set 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 Commenti
madhan ravi
madhan ravi il 9 Set 2019
Modificato: madhan ravi il 9 Set 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 il 9 Set 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. :)

Accedi per commentare.

Categorie

Scopri di più su Programming in Help Center e File Exchange

Prodotti


Release

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by