I am trying to display a plot in customary units if x = 0 or the same plot in metric units if x = 1. However, no matter whether I enter 0 or 1 for x, the program returns only the metric plot. The customary plot works fine if I take out that part of the code and run it separately. Am I missing something in the syntax?
prompt = ' Enter 0 for customary units or 1 for metric units: '; x = input(prompt); if x == '0'; disp(Tcust); sc = [custWS1; custWS2; custWS3; custWS4; custWS5; custWS6; custWS7; custWS8; custWS9; custWS10]; hc = [3; 8; 13; 33; 55; 155; 245; 382; 519; 656]; semilogy(sc,hc); title('Boundary Layer Plot'); xlabel('Wind Speed, mph'); ylabel('Height, ft'); else x == '1'; disp(Tmet); sm = [metWS1; metWS2; metWS3; metWS4; metWS5; metWS6; metWS7; metWS8; metWS9; metWS10]; hm=[0.9; 2.44; 3.96; 10; 16.8; 47.2; 74.7; 116; 158; 200]; semilogy(sm,hm); title('Boundary Layer Plot'); xlabel('Wind Speed, m/s'); ylabel('Height, m'); end
Best Answer