Can you please write code that i can copy and paste into matlab for this questio
ID: 3870813 • Letter: C
Question
Can you please write code that i can copy and paste into matlab for this question
2. program that creates a table that allows hikers to estimate their altitude Write a MATLAB based on the temperature of their boiling water. Given p -29.92111-6.8753 × 10-6h)sasse, T,-49.161 Inlp)+44.932 where p is the atmospheric pressure in inches of mercury, T, is boiling temperature in F and h is altitude in feet. Program requirements: The program should use the short format for outputting to the command window. prompt that asks the user to input the elevation range as a vector. Ex) [x x x] temperature and the table should be printed to the command window a. b. The program should display a welcome message (dlisp command) and anothei c. The table should have two columns, the first altitude and the second boiling d. The table should be output to a file called 'boilingtemp_ elevation table.txt (fprintf command) Hint: to make everything look nice, use spaces and the %05·Of flag for the altitude and %s-2f for the Boiling Temperature. Hint 2.0: Displaying the table to the command window (part c) and outputting (part d) it to the file do not have to be in the same lines of code. Hint 3.0: look at what it means that fprintf is vectorized from the last in class notes. e. In addition to the data, the "boilingtemp_elevation table.txf" file should include the title "Custom Boiling Temperature to Elevation Conversion Table" Upon completion of the program, the user should be notified that the program was completed successfully and that a file was saved. (disp command) fExplanation / Answer
Example Input: [500:100:5000]
disp("Welcome to the Custome Boiling Temperature to Conversion Elevation Program");
h = input('Enter the elevation range in the form [start:step:end]')
p = [((29.921*(1-6.8753*10^(-6)).*h)).^5.2559];
T = [(49.161.*log(p)+44.932)];
fprintf("Altitute(Feet) Temperature(F) ");
fprintf('%05.0f %5.2f ', [h; T]);
fid = fopen('boilingtemp_elevation.txt','wt');
fprintf(fid,'Custome Boiling Temperature to Conversion Elevation ');
fprintf(fid,'%05.0f %5.2f ', [h; T]);
fclose(fid)
disp("Program completed successfully and a file saved")
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.