Concept explainers
You have been assigned to a new project at work. The previous engineer had created the following files, which your new boss claims do not work. Debug the program to correct all errors.
These files must be corrected to eliminate any syntax, runtime, formula coding, and formula derivation errors. You may assume that the header comments at the top of the program and all comments throughout the program are correct.
% Problem Statement: A cylindrical tank filled to
% a height of 25 feet with tribromoethylene has been
% pressurized to 3 atmospheres (P_s = 3 atm).
% The total pressure (P_t) at the bottom of the tank is
% 5 atmospheres.
% This program will determine the density of the
% tribromoethylene in units of kilograms per cubic meter.
% Inputs :
% Height H 25 ft
% Surface Pressure P_s 3 atm
% Total Pressure P_t 5 atm
% Outputs:
% Density rho ? kg/m^3
% Assumptions:
% Gravity g 9.8 m/s^2
% Define input variables
25 ft H;
3 atm P_s;
5 atm P_t;
9.8 m/s^2 = g;
% Convert total and surface pressure from atm to Pa
Psurf = P*1,211,458;
P_t = P_t*14.7;
% Convert height from ft to m
H*3.28;
% Calculate density, knowing the calculation of total
% pressure using equation P_t P_s + (rho) (g) (H)
P_t = P_s + (rho) (g) (H)
Want to see the full answer?
Check out a sample textbook solutionChapter 16 Solutions
Thinking Like an Engineer: An Active Learning Approach (4th Edition)
- Choose the correct answer, please, I need the solution as soon as possiblearrow_forwardWhich of the follow statement(s) correctly completes the following sentence fragment? The setup() function in an Arduino sketch ... (There may be more than one correct answer) a) is executed only once after a new sketch is uploaded to the Arduino board, or the Arduino board is reset (user presses "reset" button). b) can be replaced by a user-defined function like "my_setup()" c) must always start by making a serial connection to the host computer with Serial.begin(). d) is executed only once when an Arduino board that has been disconnected from the USB cable is reconnected to that cable. (Assume that the other end of the USB cable is connected to a computer)arrow_forwardQ4: Create a Visual Basic Project to find the value of the following series: h? h4 h3 cos(h) = h – 2! 3! 4! Write the code program so that the value of angle (h) is entered into inputbox. Estimate the value of series (cos(h)) so that the absolute value of any term is greater or equal to 10-6. Display the required number of terms (N) which it used in this series in a text box and display the result of series (cos(h)) in another separate text box.arrow_forward
- The picture that has two graphs are generated by this code. Every time I run it on MATLAB it keeps generating graphs with different curves. The picture that shows one graph is the curve that I want to keep. Please keep the color of the lines and the circles and keep the title of the graph the same. I want everything to be the same except I want the line to look exactly like the picture with one graph on it. Use this code on MATLAB and fix it and then send the correct code back please. % Sample data for Diesel and Petrol cars carPosition = linspace(1, 60, 50); % Assumed positions of cars % Use the 'seed' function instead of 'rng' seed = 50; % Define your seed here rand('seed',seed); % Assumed CO2 emissions for Diesel and Petrol CO2Diesel = 25 + 5*cos(carPosition/60*2*pi) + randn(1, 50)*5; % Random data for Diesel CO2Petrol = 20 + 5*sin(carPosition/60*2*pi) + randn(1, 50)*5; % Random data for Petrol % Fit polynomial curves with a reduced degree of 2 pDiesel = polyfit(carPosition,…arrow_forwardThere is a small space between the orange and purple line could you please connect the two lines together also can you please make the purple line shorter and then connect the purple line to the orange line, please take out the box that says “Diesel, petrol, Diesel best fit, petrol best fit”. Also when ever I run this code the graph shows up but there are still errors that comes up could you please fix them when you are running this on MATLAB. Please use this code on MATLAB and fix it. % Sample data for Diesel and Petrol cars carPosition = linspace(1, 60, 50); % Assumed positions of cars % Fix the random seed for reproducibility rng(50); % Assumed CO2 emissions for Diesel and Petrol CO2Diesel = 25 + 5*cos(carPosition/60*2*pi) + randn(1, 50)*5; % Random data for Diesel CO2Petrol = 20 + 5*sin(carPosition/60*2*pi) + randn(1, 50)*5; % Random data for Petrol % Fit polynomial curves pDiesel = polyfit(carPosition, CO2Diesel, 3); pPetrol = polyfit(carPosition, CO2Petrol, 3); % Generate…arrow_forwardDon't Use Chat GPT Will Upvote And Give Solution In 30 Minutes Pleasearrow_forward
- Please provide the correct matlab code for the following question.arrow_forwardCould you please fix my code it’s supposed to look like the graph that’s on the picture. But the lines do not cross eachother at the beginning. Could you make the lines look like the lines on the graph? Use this code in MATLAB and fix it. % Sample data for Diesel and Petrol cars carPosition = linspace(1, 60, 50); % Assumed positions of cars % Define your seed here seed = 50; rand('seed',seed); % Set the seed for reproducibility % Assumed CO2 emissions for Diesel and Petrol CO2Diesel = 25 + 5*cos(carPosition/60*2*pi) + randn(1, 50)*5; % Random data for Diesel CO2Petrol = 20 + 5*sin(carPosition/60*2*pi) + randn(1, 50)*5; % Random data for Petrol % Fit polynomial curves with a reduced degree of 2 pDiesel = polyfit(carPosition, CO2Diesel, 2); pPetrol = polyfit(carPosition, CO2Petrol, 2); % Generate points for best fit lines fitDiesel = polyval(pDiesel, carPosition); fitPetrol = polyval(pPetrol, carPosition); % Plotting the data figure; hold on; % Plot Diesel best fit line…arrow_forwardI need help solving these 3 simple parts, if you can not answer all 3 parts then please leave it for another tutor, thank you.arrow_forward
- 1) A low-friction cart is placed between two identical springs attached to rigid walls. If you push the cart against one of the springs and release it, it will continue to move back and forth between the springs. www Draw a force-time graph showing the sum of the horizontal forces exerted on the cart as it moves back and force between the springs. Scientific Abilities Is able to construct a force diagram Missing No representation is constructed. Inadequate FD is constructed but contains major errors such as incorrect mislabeled or not labeled force vectors, length of vectors, wrong direction, extra incorrect vectors are added, or vectors are missing. Needs Improvement FD contains no errors in vectors but lacks a key feature such as labels of forces with two subscripts or vectors are not drawn from single point, or axes are missing. Adequate The diagram contains no errors and each force is labeled so that it is clearly understood what each force represents. Explain whether or not this…arrow_forwardUse MATLAB please make code for this.arrow_forwardThe first photo is the question, where the 2nd shows some problem solving strategiesarrow_forward
- Elements Of ElectromagneticsMechanical EngineeringISBN:9780190698614Author:Sadiku, Matthew N. O.Publisher:Oxford University PressMechanics of Materials (10th Edition)Mechanical EngineeringISBN:9780134319650Author:Russell C. HibbelerPublisher:PEARSONThermodynamics: An Engineering ApproachMechanical EngineeringISBN:9781259822674Author:Yunus A. Cengel Dr., Michael A. BolesPublisher:McGraw-Hill Education
- Control Systems EngineeringMechanical EngineeringISBN:9781118170519Author:Norman S. NisePublisher:WILEYMechanics of Materials (MindTap Course List)Mechanical EngineeringISBN:9781337093347Author:Barry J. Goodno, James M. GerePublisher:Cengage LearningEngineering Mechanics: StaticsMechanical EngineeringISBN:9781118807330Author:James L. Meriam, L. G. Kraige, J. N. BoltonPublisher:WILEY