Undefined function or variable 'Tw'
Mostra commenti meno recenti
Okay I am trying to build a function and execute it and I keep getting an error. Any help would be appreciated.
function[Td,RH]=Dewpoint(T,Tw,Psta)
Es=6.112^((17.67*T)/(T+243.5)); Ew=6.112^((17.67*Tw)/(Tw+243.5));
E=Ew-(Psta*(T-Tw))*0.00066*(1+0.00115*Tw); RH=100*(E/(Es)); Td=(243.5*log(E/6.112))/(17.67-log(E/6.112)); end
That's my function. When I try to execute it in a new script file I get this error.
>> [Td,RH]=Dewpoint(25,19,985); fprintf('For a wet bulb temperature of %.2f, dry point temperture of %.2f and pressure of %.2f, the dew point temperature and relative humidity are %.2f and %.2f.\n',Tw,T,Psta,Td,RH) Undefined function or variable 'Tw'.
Help is greatly appreciated as I am new to using Matlab.
Risposte (1)
Honglei Chen
il 7 Set 2017
0 voti
Looks like the issue is more on the fprintf line, not the function call. Indeed you are using variable name Tw in fprintf without defining it.
HTH
Categorie
Scopri di più su Performance and Memory in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!