if temperature == 1 T_C= (5/9)*(T1-32)+273; T_H= (5/9)*(T2-32)+273;
end if temperature == 2 T_C= T1+273; T_H= T2+273; end if temperature == 3 T_C= T1; T_H= T2; end if temperature == 4 T_C= (5/9)*(T1); T_H= (5/9)*(T2); end
if T_H>=T_C COP=(T_C/(T_H-T_C)); if COP >= 0 COP=(T_C/(T_H-T_C)); fprintf('The coefficient of performance is %f \n',COP) else beep disp('Ensure that T_Cold is not greater than T_Hot and that T_Cold and T_Hot are equal or greater than zero when converted to Kelvin') end end if T_H>=T_C h=50; A=1; Qdot=h*A*(T_C-T_H); if COP>=0 Qdot=h*A*(T_C-T_H); fprintf('The heat transfer due to convection is %f W \n', Qdot) end
else beep disp('Ensure that T1 is not greater than T2') end
I enter this command:
Error in james (line 4) temperature=menu('Temperature Scale','Fahrenheit','Centigrade','Kelvin','Rankine');
Output argument "COP" (and maybe others) not assigned during call to "C:\Users\....".
Where am I going wrong in my code? I do not know where exactly I am going wrong because everything seems to be called for.