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_forwardMy 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_forward
- I’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_forwardUse MATLAB please make code for this.arrow_forward
- For 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_forwardI wanted to create two spheres that overlap each other in MATLAB. The image has my code and results. I only see one sphere in the results. Why is that? Can you give me the code that will create two overlaying spheres in one plot?arrow_forwardUse MATLABarrow_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