Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The code that you see run a similar graph but it is not exactly that same as the graph that you see on the picture.

The code that you see run a similar graph but it is not exactly that same as the graph that you see on the picture. Could you please run this code on matlab and fix the code so that it runs the same graph you see on the picture. I want the curve of the lines and the color of the lines exactly the same. Also could you make the blue and oragne circles a little bit more spread out just like you see on the picture. Basically just make the same
graph that you see on the picture.
Fix this code on matlab.
% Sample data for Diesel and PetrolcarPosition = linspace(6,40,50);% CO2 emissions for DieselCO2Diesel =25+5*cos(carPosition/60*2*pi)+5*rand(1,50);% CO2 emissions for PetrolCO2Petrol =20+5*sin(carPosition/60*2*pi)+5*rand(1,50);% Fit polynomial curvespDiesel = polyfit(carPosition, CO2Diesel, 3);pPetrol = polyfit(carPosition, CO2Petrol, 3);% Generate points for best fit linesfitDiesel = polyval(pDiesel, carPosition);fitPetrol = polyval(pPetrol, carPosition);% Plotting the datafigure;hold on;scatter(carPosition, CO2Diesel, 'o', 'MarkerEdgeColor', [10.50]); % Diesel datascatter(carPosition, CO2Petrol, 'o', 'MarkerEdgeColor', [00.51]); % Petrol dataplot(carPosition, fitDiesel, 'Color', [10.50], 'LineWidth', 2); % Diesel best fitplot(carPosition, fitPetrol, 'Color', [00.51], 'LineWidth', 2); % Petrol best fit% Customize the plotxlabel('Car Position');ylabel('CO2 Weighted Percentage');title('Weighted CO2 Emissions');legend('Diesel', 'Petrol', 'Diesel Best Fit', 'Petrol Best Fit');grid on;ylim([1540]); % Set y-axis limitshold off;
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions