Figure 1 File Edit View Insert Tools Desktop Window Help 130.n 40 C C itD 35 itp t 1') P Em etr CO2 Weighted Percentage о 25 20 OX Weighted CO2 Emissior. QQA D 0 C ° 15 C о 10 0 10 20 о 00 30 100 0 Car Position File Edit View Insert oject30.n Tools Desktop Window Help 40 Lon, C Lon, C . fitD 35- fitP lot tion') ted P CO2 Em 'Petr CO2 Weighted Percentage. 30 2500 20 0. 15 15 10 10 5 10 10 O Diesel Petrol Diesel Best Fit Petrol Best Fit 40 50 60 Weighted CO2 Emissions Diesel Petrol Diesel Best Fit Petrol Best Fit 20 20 30 Car Position 0 40 40 о 50 60 50 Weighted CO2 Emmisions 50 Diesel Petrol 10 40 30 CO2 Weighted Percentage 20 8 10 0 о о 800 0 0 о % -10 0 ୦୧ о 10 10 20 30 40 40 50 60 Car Position Diesel Best Fit Petrol Best Fit

Elements Of Electromagnetics
7th Edition
ISBN:9780190698614
Author:Sadiku, Matthew N. O.
Publisher:Sadiku, Matthew N. O.
ChapterMA: Math Assessment
Section: Chapter Questions
Problem 1.1MA
icon
Related questions
Question
I’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 scatter(carPosition, CO2Petrol, 'o', 'MarkerEdgeColor', [0 0.5 1]); % Petrol data plot(carPosition, fitDiesel, 'Color', [1 0.5 0], 'LineWidth', 2); % Diesel best fit plot(carPosition, fitPetrol, 'Color', [0 0.5 1], 'LineWidth', 2); % Petrol best fit % Customize the plot xlabel('Car Position'); ylabel('CO2 Weighted Percentage'); title('Weighted CO2 Emissions'); legend('Diesel', 'Petrol', 'Diesel Best Fit', 'Petrol Best Fit'); grid on; hold off;
Figure 1
File Edit View Insert Tools Desktop Window Help
130.n
40
C
C
itD
35
itp
t
1')
P
Em
etr
CO2 Weighted Percentage
о
25
20
OX
Weighted CO2 Emissior. QQA
D
0
C
°
15
C
о
10
0
10
20
о
00
30
100
0
Car Position
File Edit View Insert
oject30.n
Tools Desktop Window Help
40
Lon, C
Lon, C
. fitD
35-
fitP
lot
tion')
ted P
CO2 Em
'Petr
CO2 Weighted Percentage.
30
2500
20
0.
15
15
10
10
5
10
10
O
Diesel
Petrol
Diesel Best Fit
Petrol Best Fit
40
50
60
Weighted CO2 Emissions
Diesel
Petrol
Diesel Best Fit
Petrol Best Fit
20
20
30
Car Position
0
40
40
о
50
60
Transcribed Image Text:Figure 1 File Edit View Insert Tools Desktop Window Help 130.n 40 C C itD 35 itp t 1') P Em etr CO2 Weighted Percentage о 25 20 OX Weighted CO2 Emissior. QQA D 0 C ° 15 C о 10 0 10 20 о 00 30 100 0 Car Position File Edit View Insert oject30.n Tools Desktop Window Help 40 Lon, C Lon, C . fitD 35- fitP lot tion') ted P CO2 Em 'Petr CO2 Weighted Percentage. 30 2500 20 0. 15 15 10 10 5 10 10 O Diesel Petrol Diesel Best Fit Petrol Best Fit 40 50 60 Weighted CO2 Emissions Diesel Petrol Diesel Best Fit Petrol Best Fit 20 20 30 Car Position 0 40 40 о 50 60
50
Weighted CO2 Emmisions
50
Diesel
Petrol
10
40
30
CO2 Weighted Percentage
20
8
10
0
о
о
800
0 0
о
%
-10
0
୦୧
о
10
10
20
30
40
40
50
60
Car Position
Diesel Best Fit
Petrol Best Fit
Transcribed Image Text:50 Weighted CO2 Emmisions 50 Diesel Petrol 10 40 30 CO2 Weighted Percentage 20 8 10 0 о о 800 0 0 о % -10 0 ୦୧ о 10 10 20 30 40 40 50 60 Car Position Diesel Best Fit Petrol Best Fit
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Elements Of Electromagnetics
Elements Of Electromagnetics
Mechanical Engineering
ISBN:
9780190698614
Author:
Sadiku, Matthew N. O.
Publisher:
Oxford University Press
Mechanics of Materials (10th Edition)
Mechanics of Materials (10th Edition)
Mechanical Engineering
ISBN:
9780134319650
Author:
Russell C. Hibbeler
Publisher:
PEARSON
Thermodynamics: An Engineering Approach
Thermodynamics: An Engineering Approach
Mechanical Engineering
ISBN:
9781259822674
Author:
Yunus A. Cengel Dr., Michael A. Boles
Publisher:
McGraw-Hill Education
Control Systems Engineering
Control Systems Engineering
Mechanical Engineering
ISBN:
9781118170519
Author:
Norman S. Nise
Publisher:
WILEY
Mechanics of Materials (MindTap Course List)
Mechanics of Materials (MindTap Course List)
Mechanical Engineering
ISBN:
9781337093347
Author:
Barry J. Goodno, James M. Gere
Publisher:
Cengage Learning
Engineering Mechanics: Statics
Engineering Mechanics: Statics
Mechanical Engineering
ISBN:
9781118807330
Author:
James L. Meriam, L. G. Kraige, J. N. Bolton
Publisher:
WILEY