Concept explainers
You are studying the properties of tiny spheres generated by an automated process. You collect data on a large number of the spheres and record this data in the two-row matrix SphereData Each pair of values (each column) represents the data for a specific sphere. The first row of sphereData contains the diameters of the spheres in millimeters; the second row contains the masses of the corresponding spheres in micrograms. Write a single MATLAB command to achieve each of the following tasks.
a. Create a third row in sphereData that contains the volumes [cubic millimeters] of the corresponding spheres represented in the first two rows of sphereData
b. Create a fourth row in sphereData that contains the specific gravities of the corresponding spheres represented in sphereData
c. Create a column
First element: Average diameter of all spheres
Third element: Maximum diameter of all spheres
Want to see the full answer?
Check out a sample textbook solutionChapter 15 Solutions
Thinking Like an Engineer: An Active Learning Approach (4th Edition)
- .arrow_forwardMULTIPLE CHOICE -The answer is one of the options below please solve carefully and circle the correct option Please write clear .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_forward
- Hello I’m trying to make the graph that you see in the picture, I’m trying the exact copy of that graph using this code but I’m having a hard time doing that. Could you change the code so that it looks like the graph that you see on the picture using MATLAB, please send the code when you are finished. % Sample data for Diesel and Petrol cars carPosition = linspace(1, 60, 50); % Assumed positions of cars % Fix the random seed for reproducibility rng(45); % 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); % Plotting the data figure; hold on; scatter(carPosition, CO2Diesel, 'o', 'MarkerEdgeColor', [1 0.5…arrow_forwardHelp me solve this using MATLABarrow_forwardPlease provide the correct matlab code for the following question.arrow_forward
- My professor said that I need to use the numbers as shown on the picture and make the exact graph that is also shown on the picture. But I don’t know how to put this in to MATLAB. Please send the code that makes the graph that is shown in the picture. Make it 100% exactly the same.arrow_forwardI’m making the graph that you see in the picture but the code that I’m using makes the line with to many curves. Could you make the lines look like the one that you see on the graph. Don’t change the color just make it with a little bit less curves like you see in the picture. 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 points for best fit lines fitDiesel = polyval(pDiesel, carPosition); fitPetrol = polyval(pPetrol, carPosition); % Combined best fit combinedFit = (fitDiesel + fitPetrol) / 2;…arrow_forwardThis code keeps on generating graphs with different curves. The picture that you see two different graphs comes from the same code but both of them have different curves. I need the curve to look like the picture that only has one graph. I basically need the line to have a slight curve and every time I run the code it will come up as the same graph every time. Use this code on MATLAB and fix it % 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…arrow_forward
- I created a MATLAB code to plot the orbit of a satellite at an altitude of 300 km (LEO). I wanted to propagate my code for 2 revolutions but instead I used (180*60) because it takes 90 minutes to make a full rotation around the earth in LEO. Is that correct? Also, if I wanted to use revolutions how would I propagate it for 2 revs? Would my t = [0 4*pi].arrow_forwardMatlab Codearrow_forwardUse MATLAB please make code for this.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