Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: MatLab Output Argument Error
Replies: 2   Last Post: Nov 6, 2012 9:45 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
James

Posts: 4
Registered: 11/1/12
MatLab Output Argument Error
Posted: Nov 6, 2012 2:05 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

This is my code:

function [COP,Qdot]=james(T1,T2)

temperature=menu('Temperature Scale','Fahrenheit','Centigrade','Kelvin','Rankine');

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


end



I enter this command:

[COP,Qdot]=james(110,80);

and get:

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.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.