function [HVAC_data] = HVAC_calculation(user_answers,live_load_BTU_hr) //This function takes the user's answers and calculates the live load //in BTU per hr. heating_matrix = [1, 18.4, 196.7, 5408.7, 5988.2; 2, 5.3, 243.9, 6703.9, 7424.4; 3, -13.9, 313.0, 8602.2, 9529.4; 4, 7.3, 236.7, 6506.2, 7205.1; 5, 34.1, 140.1, 3856.5, 4267.0; 6, 7.5, 235.9, 6486.4, 7183.2; 7, 52.6, 73.5, 2027.4, 2238.7; 8, 19.9, 191.3, 5260.4, 5823.8; 9, 41.8, 112.5, 3095.2, 3422.8; 10, 5.2, 244.2, 6713.8, 7435.4; 11, 33.2, 143.4, 3945.5, 4365.6; 12, 29.5, 156.7, 4311.3, 4771.3;]; //city # //99% dry bulb heating temp. //single window BTU per hr loss //20ft BTU per hr loss //24ft BTU per hr loss cooling_matrix = [1, 91.4, 66.3, 1822.3, 2020.4; 2, 92.2, 69.2, 1901.6, 2108.2; 3, 87.0, 50.4, 1386.5, 1537.8; 4, 86.5, 48.6, 1337.0, 1483.0; 5, 95.5, 81.0, 2228.4, 2470.1; 6, 92.7, 71.0, 1951.1, 2163.0; 7, 90.8, 64.1, 1762.9, 1954.6; 8, 92.3, 69.5, 1911.5, 2119.1; 9, 108.3, 127.2, 3496.3, 3873.9; 10, 83.3, 37.1, 1020.0, 1132.1; 11, 97.6, 88.6, 2436.4, 2700.4; 12, 81.6, 31.0, 851.6, 945.6;]; //city # //1% dry bulb cooling temp. //single window BTU per hr gain //20ft BTU per hr gain //24ft BTU per hr gain air_changes_matrix = [1, 10932.5, 3168.6, 12756.1, 3697.2; 2, 13931.5, 3301.8, 16255.5, 3852.6; 3, 18659.2, 2431.2, 21771.8, 2836.8; 4, 13472.4, 2347.6, 15719.7, 2739.3; 5, 7535.2, 3842.1, 8792.2, 4483.1; 6, 13415.5, 3383.0, 15653.4, 3947.4; 7, 3803.8, 3069.6, 4438.3, 3581.7; 8, 10593.6, 3314.3, 12360.8, 3867.2; 9, 5945.7, 5865.9, 6937.5, 6844.4; 10, 13952.1, 1803.6, 16279.5, 2104.5; 11, 7719.2, 4182.9, 9006.8, 4880.7; 12, 8510.3, 1510.1, 9929.9, 1762.0;]; //city number //20ft winter //20ft summer //24ft winter //24ft summer if user_answers(1) == 20 trailer_column = 4; //use 4th column in matrices above for 20ft trailer air_ex = [2,3]; //use 2nd and 3rd columns for air changes matrix else trailer_column = 5; //use 5th column in matrices above for 24ft trailer air_ex = [4,5]; //use 4th and 5th columns for air changes matrix end for loop_num = 1:12 //loop through all cities if user_answers(2) == loop_num //the city the user picked matches the loop // //heating for winter one_percent_heat_temp = heating_matrix(loop_num,2) //second column window_heat_BTU_hr = heating_matrix(loop_num,3)*user_answers(14); //BTU per hr heat loss from all windows trailer_heat_BTU_hr = heating_matrix(loop_num,trailer_column) + ... air_changes_matrix(loop_num,air_ex(1)); //BTU per hr heat loss from trailer shell HVAC_heat_BTU_hr = window_heat_BTU_hr + trailer_heat_BTU_hr; //add subtotals // //cooling for summer one_percent_cool_temp = cooling_matrix(loop_num,2) //second column window_cool_BTU_hr = cooling_matrix(loop_num,3)*user_answers(14); //BTU per hr heat loss from all windows trailer_cool_BTU_hr = cooling_matrix(loop_num,trailer_column) + ... air_changes_matrix(loop_num,air_ex(2)); //BTU per hr heat loss from trailer shell HVAC_cool_BTU_hr = window_cool_BTU_hr + trailer_cool_BTU_hr; //add subtotals end end HVAC_data = [one_percent_heat_temp; HVAC_heat_BTU_hr; one_percent_cool_temp; HVAC_cool_BTU_hr;]; endfunction