You are assessing the price of various components from different vendors and wish to find the least expensive vendor for each component. The prices of the parts from each vendor are stored in a matrix, VendCost. Each row corresponds to a specific vendor and each column corresponds to a specific component. If a specific part is not offered by a vendor, the corresponding entry will be –1.
Write a program that will determine which vendor offers the cheapest price for each component, and place the results in a two matrix Cheapest with the same number of columns as there are columns in VendCost. Each entry in the first row of Cheapest. Should be an integer corresponding to the row number of the vendor with the cheapest price for the correspondent, and the entries in row 2 should contain the lowest price for that component. You may assume that each part is available from at least one of the listed vendors. If two or more vendors offer a component at the same lowest price, you may choose either one.
You may not use the built-in min function or other similar functions to solve this problem. You may not use direct matrix operations to solve this problem; you must do it using for loops (in a meaningful way). Your solution must work for any number of vendors and any number of components. Example:
Want to see the full answer?
Check out a sample textbook solutionChapter 20 Solutions
Thinking Like an Engineer: An Active Learning Approach (3rd Edition)
- Could you make this graph, make the purple ling going across the orange line. Please make the orange and blue circles in the background of the graph. Please use the same titles. Make the exact graph. Do not send me back a different graph please send me the exact graph. Please make the exact copy. Make sure it doesn’t look different than the picture. Make the graph exactly same graphs. Make the code on MATLAB. Again make the exact graph. Do not give me a different graph.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_forwardCreate an illustration or diagram of the amusement park ride called THE BUMPER CAR RIDE, then proceed to add labels based on the guidelines provided within the image. The screenshot is the example of the diagram BUT THAT IS A DIAGRAM OF THE GRAVITRON RIDE. I need an illustration DIAGRAM OF THE BUMPER CAR RIDE, do not answer using AI.arrow_forward
- This 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.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_forward
- Create the following images in AUTOCAD using web.autocad.com (Take screenshots of your work.) Design 3 6.50 1.50-- 3.50 1.00 1.00 4.00 1.00 1.75 2.75 4.75arrow_forwardThe 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_forwardDon't Use Chat GPT Will Upvote And Give Solution In 30 Minutes Pleasearrow_forward
- Note: Round your final answer to 2 decimal places if it is not a whole number. Note:- Do not provide handwritten solution. Maintain accuracy and quality in your answer. Take care of plagiarism. Answer completely. You will get up vote for sure.arrow_forwardI’m using this code in MATLAB but for some odd reason every time I run it on MATLAB I keep on getting a different graphs. In the picture that shows two different graphs are from the same code, but I need to it to look like the picture that has one graph. Could you please fix it. To make it look like the picture that has one graph? Here is the code: % Sample data for Diesel and Petrol carPosition = linspace(1, 60, 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); % Plotting the data figure; hold on; scatter(carPosition, CO2Diesel, 'o', 'MarkerEdgeColor', [1 0.5 0]); % Diesel data…arrow_forwardCan i get help with these questionsarrow_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