A sample of the data provided in the Microsoft Excel file EnergyData.xlsx online follows. The file contains energy consumption data by energy source per year in the United States, measured in petaBTUs.
a. Write the MATLAB code necessary to read the Microsoft Excel file and store each column of data into different variables. Create the following:
- Yr: A vector of all of the years in the worksheet.
- FF: A vector of all of the fossil fuels for each year in Yr.
- ENI: A vector of all electric imports for each year in Yr.
- Nuc: A vector of all nuclear energy consumption for each year in Yr.
- Ren: A vector of all renewable energy consumption for each year in Yr.
- Hdr: A cell array of all of the headers in row 1.
You may not hard-code these variables—they should be imported from the Excel file.
b. Create a new variable. Totalconsumption, which contains the sum of the four columns of energy consumption data for each year. In other words, since all five of the
c. Calculate the average fossil fuel consumption in the entire data set. For this code, you may assume that you have correctly defined FF, the variable containing the fossil fuel consumption data, in part (a). Display the result of the calculation in the following format, where the number is shown to two decimal places:
The average fossil fuel consumption is _____ petaBTU.
Want to see the full answer?
Check out a sample textbook solutionChapter 18 Solutions
Thinking Like an Engineer: An Active Learning Approach (3rd Edition)
- How do I input this code for this MATLAB problem? Thanks!arrow_forwardI need help with the purple line the line that you see one the graph on the picture needs to be on the graph. Use this code to add the purple line and make sure it’s crossing the orange line. Please make sure the lines are positioned the same way it is shown on the picture with the graph. Use this code on MATLAB and add the purple line. % 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, CO2Diesel, 2); pPetrol = polyfit(carPosition, CO2Petrol, 2); % Generate points for best fit lines fitDiesel = polyval(pDiesel, carPosition);…arrow_forwardPlease include a kinamatic diagram (for velocity) Please DO NOT solve this using velocity analysis (cartesian vector analysis). I would like it to be solved using scalar method. We dont use 3D in this course. We only use scalar analysis for the relative velocity equation as requested in the question (writing the x and y components of the equation and solving the equations for the unknowns). Below I have attached a sample question with solution in order to get an idea on how to use the scalar method to solve my question. I would like question this to be solved in a similar way. Thank you for your understanding. If you can solve it as soon as possible that would be great and I will give you a thumps up and positive feedback :)arrow_forward
- Hi I need help to make the line change into a different color, I half of the line to be orange and I need the other half of the line towards the end to be purple as shown in the picture. Also I need there be a box saying Diesel, petrol, diesel best fit, petrol best fit. This part is also shown in the graph. Please use this code and fix it in MATLAB: % 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 positions of cars 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 points for best fit lines fitDiesel = polyval(pDiesel, carPosition); fitPetrol = polyval(pPetrol, carPosition); % Combine the best fit lines combinedFit =…arrow_forwardI am trying to plot an orbit in MATLAB. There is something wrong with my code because the final values I get are incorrect. The code is shown below. The correct values are in the image. mu = 3.986*10^5; % Earth's gravitational parameter [km^3/s^2] % Transforming orbital elements to cartesian coordinate system for LEOa_1 = 6782.99;e_1 = 0.000685539;inc_1 = 51.64;v_1 = 5;argp_1 = 30;raan_1 = 10; [x_1, y_1, z_1, vx_1, vy_1, vz_1] = kep2cart(a_1, e_1, inc_1, raan_1, ... argp_1, v_1); Y_1 = [x_1, y_1, z_1, vx_1, vy_1, vz_1]; % time_span for two revolutions (depends on the orbit)t1 = [0 (180*60)]; % Setting tolerancesoptions = odeset('RelTol',1e-12,'AbsTol',1e-12); % Using ODE45 to numerically integrate for LEO[t_1, state_1] = ode45(@OrbitProp, t1, Y_1, options); function dYdt = OrbitProp(t, Y) mu = 3.986*10^5; % Earth's gravitational parameter [km^3/s^2] % State Vector x = Y(1); % [km] y = Y(2); % [km] z = Y(3); % [km] vx = Y(4);…arrow_forwardNewton’s 2nd Law Lab (Modeling friendly lab) Go to the PhET simulation Forces & Motion. https://phet.colorado.edu/sims/html/forcesandmotionbasics/latest/forcesandmotionbasics_en.html Select “Acceleration” Click to show Forces, Sum of Forces, Values, Mass, and Acceleration. There are two experiments for this activity – make sure you include both. Experiment #1: Acceleration vs. Force In this lab you will determine the relationship between acceleration and net force. Choose a mass at the beginning, and keep it constant for this entire experiment. Set the friction to zero. This will make your Applied Force equal to the net force. Record data for five different values of Applied Force. Graph Acceleration vs. Net Force. Graph this in Google sheets(you want a line graph - it should only have one line). Make sure that Applied Force information is used as the x value Make sure that Acceleration information is used as the y value Add a trendline – see what fits best –…arrow_forward
- Engr 215 Matlab Fahrenheit to Celsius using multiple statements Given a Fahrenheit value temperatureFahrenheit, write a statement that assigns temperatureCelsius with the equivalent Celsius value. While the equation is C = 5/9 * (F - 32), as an exercise use two statements, the first of which is "fractionalMultiplier = 5/9;"]arrow_forwardFor the Following question Graph all 4 : [I just need all 4 graphs and please explain and make clean solution] Position vs time Velocity vs time Acceleration vs time Force vs time [For your convenience, I have solved the numerical solutions for the problem] (Please Look at the picture since it is much cleaner) Question : A 550 kilogram mass initially at rest acted upon by a force of F(t) = 50et Newtons. What are the acceleration, speed, and displacement of the mass at t = 4 second ? a =(50 e^t)/(550 ) [N/kg] v = ∫_0^t▒(50 e^t )dt/(550 )= v_0 +(50 e^t-50)/550=((e^t- 1))/11 x = ∫_0^t▒(e^t- 1)dt/(11 )= x_0 +(e^t- t - 1)/(11 ) a(4s)=(50*54.6)/550= 4.96[m/s^2 ] v(4s)=((e^4-1))/11= 4.87[m/s] x(4s)=((e^4- 4 - 1))/11= 4.51 [m]arrow_forwardPlease help Matlabarrow_forward
- Could you change the lines in to two lines just like it shows in the graph . Make it exactly those two lines. Keep the colors and the same. Use this code on 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); % Combined best fit combinedFit = (fitDiesel + fitPetrol) / 2; % Plotting the data figure; hold on; % Define the split index and shorten…arrow_forwardDon't Use Chat GPT Will Upvote And Give Handwritten Solution Pleasearrow_forwardYour choices from the drop down menu are "1, 2.5, and 3.5" Please see both images for reference. Thanks!arrow_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