Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- h_11000 = 0:500:11000;
- h_30000 = 0:500:30000;
- temperature_c = 0;
- pressure = 0;
- temperature_k = 273.1;
- for ii = 1:numel(h_11000)
- if h_11000(ii) > 25000
- temperature_c(ii) = -131.21 + (0.00299 * h_11000(ii));
- pressure(ii) = 2.488 * ((temperature_c(ii) + 273.1)/216.6)^(-11.388);
- elseif h_11000(ii) > 11000 && h_11000(ii) <= 25000 % Lower Stratosphere
- temperature_c(ii) = -56.46;
- pressure(ii) = 22.65 * exp(1.73 - (0.000157 * h_11000(ii)));
- else % h < 11000
- temperature_c(ii) = 15.04 - (0.00649 * h_11000(ii));
- pressure(ii) = 101.29 * ((temperature_c(ii) + 273.1)/(288.08))^(5.256);
- end
- end
- temperature_k = temperature_c + 273.1;
- [therm_eff, net_power, bwr, Wt, Wc, Q_in, Q_out, pr1, pr2, pr3, pr4, h1, h2, h3, h4] = function_1(pressure, temperature_k);
- for ii = 1:numel(h_30000)
- if h_30000(ii) >= 25000
- temperature_c(ii) = -131.21 + (0.00299 * h_30000(ii));
- pressure(ii) = 2.488 * ((temperature_c(ii) + 273.1)/216.6)^(-11.388);
- elseif h_30000(ii) > 11000 && h_30000(ii) < 25000 % Lower Stratosphere
- temperature_c(ii) = -56.46;
- pressure(ii) = 22.65 * exp(1.73 - (0.000157 * h_30000(ii)));
- else % h < 11000
- temperature_c(ii) = 15.04 - (0.00649 * h_30000(ii));
- pressure(ii) = 101.29 * ((temperature_c(ii) + 273.1)/(288.08))^(5.256);
- end
- end
- column_header = {'Thermal efficiency', 'Net power', 'Back Work Ratio', 'Turbine Power, Wt', 'Compressor Power, Wc', 'Rate of input heat, Qin', 'Rate of output heat, Qout', 'Pr1', 'Pr2', 'Pr3', 'Pr4', 'h1', 'h2', 'h3', 'h4'};
- column_units = {'', 'kW', '', 'kW', 'kW', 'kW', 'kW', '', '', '', '', 'kJ/kg', 'kJ/kg', 'kJ/kg', 'kJ/kg'};
- xlswrite('output.xlsx', column_header, 'Sheet1', 'A1');
- xlswrite('output.xlsx', column_units, 'Sheet1', 'A2');
- xlswrite('output.xlsx', transpose(therm_eff), 'Sheet1', 'A3');
- xlswrite('output.xlsx', transpose(net_power), 'Sheet1', 'B3');
- xlswrite('output.xlsx', transpose(bwr), 'Sheet1', 'C3');
- xlswrite('output.xlsx', transpose(Wt), 'Sheet1', 'D3');
- xlswrite('output.xlsx', transpose(Wc), 'Sheet1', 'E3');
- xlswrite('output.xlsx', transpose(Q_in), 'Sheet1', 'F3');
- xlswrite('output.xlsx', transpose(Q_out), 'Sheet1', 'G3');
- xlswrite('output.xlsx', transpose(pr1), 'Sheet1', 'H3');
- xlswrite('output.xlsx', transpose(pr2), 'Sheet1', 'I3');
- xlswrite('output.xlsx', transpose(pr3), 'Sheet1', 'J3');
- xlswrite('output.xlsx', transpose(pr4), 'Sheet1', 'K3');
- xlswrite('output.xlsx', transpose(h1), 'Sheet1', 'L3');
- xlswrite('output.xlsx', transpose(h2), 'Sheet1', 'M3');
- xlswrite('output.xlsx', transpose(h3), 'Sheet1', 'N3');
- xlswrite('output.xlsx', transpose(h4), 'Sheet1', 'O3');
- figure(1)
- plot(pressure, h_30000,);
- xlabel("Pressure");
- ylabel("Height");
- title('Line Plot of Altitude against Pressure');
- figure(2)
- plot(temperature_c, h_30000);
- xlabel("Temperature");
- ylabel("Height");
- title('Line Plot of Altitude against Temperature');
- figure(3)
- subplot(3, 1, 1)
- plot(h_11000, therm_eff);
- xlabel("Altitude");
- ylabel("Thermal Efficiency");
- title('Line Plot of Thermal Efficiency against Altitude');
- subplot(3, 1, 2)
- plot(h_11000, net_power);
- xlabel("Altitude");
- ylabel("Net Power");
- title('Line Plot of Net Power against Altitude');
- subplot(3, 1, 3)
- plot(h_11000, bwr);
- xlabel("Altitude");
- ylabel("Back Work Ratio");
- title('Line Plot of Back Work Ratio against Altitude');
- figure(4)
- subplot(2, 2, 1)
- plot(h_11000, Wt);
- xlabel("Altitude");
- ylabel("Turbine Power");
- title('Line Plot of Turbine Power against Altitude');
- subplot(2, 2, 2)
- plot(h_11000, Wc);
- xlabel("Altitude");
- ylabel("Compressor Power");
- title('Line Plot of Compressor Power against Altitude');
- subplot(2, 2, 3)
- plot(h_11000, Q_in);
- xlabel("Altitude");
- ylabel("Rate of input heat");
- title('Line Plot of Rate of input heat against Altitude');
- subplot(2, 2, 4)
- plot(h_11000, Wt);
- xlabel("Altitude");
- ylabel("Rate of output heat");
- title('Line Plot of Rate of output heat against Altitude');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement