ECEN289 F22 HW3
docx
keyboard_arrow_up
School
Texas A&M University *
*We aren’t endorsed by this school
Course
289
Subject
Mechanical Engineering
Date
Apr 3, 2024
Type
docx
Pages
7
Uploaded by AgentStorkPerson359
Max Kotas
530000126
ECEN 289: Machine Learning for EEs
Homework 3
Assigned
9/29/22
Due
10/6/22
Potential Points
50
Description
Description
: classification errors, model selection, determining parameters, and naïve Bayes inferencing.
Complete all homework questions in the space provided and upload a pdf of the completed docu-
ment on canvas by 11:59pm on the due date.
1)
classification performance metrics:
You developed a classification model which uses images of damaged vehicles at accident sites to
estimate the location of the initial impact to the vehicle. The images are combined with informa-
tion from the vehicle – speed and direction of the vehicle prior to the initial impact to classify each damaged vehicle by location of initial impact. This classification will be used in determining
the cause of the accident. The classes are {head-on, rear-end, left-front, right-front, right-rear, and left-rear. Your model was validated with video footage from intersections traffic cameras by
crash engineers. 817 vehicle crash cases were classified by your model. The following are the results from your validated classification model:
True Class
Your model estimated
Head-on = 154
Head-on = 130
Left-
front=13
Right-front 11
Rear-end = 118
Rear-
end=97
Right-
rear=11
Left-rear=9
Left-
front=1
Left-
front=96
Left-
front=86
Head-on=9
Right-
front=1
Right-
front=87
Right-
front=59
Head-
on=20
Left-
front=8
Right-
rear=143
Right-
rear=121
Right-
front=14
Rear-end=8
Left-
rear=219
Left-
rear=200
Rear-
end=13
Right-
rear=6
Max Kotas
530000126
(a)
(5 points) Create a confusion matrix for your classifier results:
[
130
0
13
11
0
0
0
97
1
0
11
9
9
0
86
1
0
0
20
0
8
59
0
0
0
8
0
14
121
0
0
13
0
0
6
200
]
(b)
(5 points) Compute the mean accuracy of your classification (show your work):
accuracy for row = true positives/(true positives + false positives)
mean accuracy = sum(accuracy for a row for each row)/n rows
mean accuracy of model = 0.8273012163
2)
understanding overfitting.
You have developed 6 models for classifying the causes of electrical insulator failures in power transformers. Assume that each of the causes of failure are approximately equally likely (i.e. balanced dataset) in this case. You have trained these models on 3756 samples and validated the results on 1246 samples that have been analyzed by experts on insulator failure. Your mod-
els give the following results:
Model
Training Accu-
racy
Validation accu-
racy
Training-F1
Validation-F1
1
0.83
0.76
0.81
0.73
2
0.94
0.72
0.9
0.71
3
0.81
0.74
0.8
0.74
4
0.79
0.71
0.79
0.7
5
0.96
0.76
0.92
0.74
6
0.80
0.75
0.78
0.72
(a)
(3 pts) Which model will you present to your boss as the best model for predicting the cause of insulator failure, and why: I would use model 5, because the difference between the validation accuracy and the validation F1 is 0 with respect to the difference in accuracies
Max Kotas
530000126
(b)
(3 pts) If you found out that the causes were not equally probable (i.e. imbalanced dataset), would you make a different choice? Justify your answer: If I found out that the causes of failure were not equally probable then I would be more likely to pick one with a higher validation accuracy because the dataset would be much more diverse and
if it can extrapolate the results from its training to a higher accuracy in the real world then it ob-
jectively a better model
3)
You are building a vision system for a robot driven vehicle. One part of the system must recognize traffic signs. As a first demonstration of your system you will restrict your design to recognizing a subset of signs {stop, speed 25, speed 35, pedestrian crossing, merge ahead, yield, do not enter, no parking, Austin city limits, and railroad crossing}. You have driven a vehicle
around the College Station area and you have counted the number of captured images of signs. These are the results:
Sign
Number
Stop
400
Speed 25
300
Speed 35
300
Pedestrian crossing
300
Merge ahead
100
Yield
300
Do not enter
100
No parking
100
Austin city limits
0
Railroad crossing
100
(a)
(5 points) Compute and present the table of the Prior probability distribution for the sign class Y for your observations.
Sign
Probability
Stop
0.2
Speed 25
0.15
Speed 35
0.15
Pedestrian crossing
0.15
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Max Kotas
530000126
Merge ahead
0.05
Yield
0.15
Do not enter
0.05
No parking
0.05
Austin city limits
0
Railroad crossing
0.05
You have determine that you will combine the output of three sensors to help determine if an object is a sign and the type of the sign. This is, of course, a classification problem. The first sensor uses a camera and a computer vision library to detect shapes. It can detect {octagon, rectangle, diamond, circle, point-down triangle}, and others that you will not need for the demonstration. This sensor will output this value as F1=Shape. A second sensor is a color sensor
from which you have selected the following colors to be output {red, green, white, yellow, orange}.
If more than one color is detected it will output one or the other with equal probability. A third sensor is a camera with character recognition software which if it detects text will output the color of the text or the word none if it does not detect any text within the sign {white, black, none, red, green} as F3=Txt-color.
Your analysis of the images shows that signs have these characteristics:
Sign
Shape
Background
color(s)
Text color
Stop
Octagon
Red
White
Speed 25
Rectangle
White
Black
Speed 35
Rectangle
White
Black
Pedestrian crossing
Diamond
Yellow
None
Merge ahead
Diamond
Yellow
None
Yield
Point down triangle
Red and white
Red
Do not enter
Circle
Red and white
White
No parking
Rectangle
White
Red
Austin city limits
Rectangle
Green
White
Max Kotas
530000126
Railroad crossing
Circle
Orange
Black
You have developed and trained a Naïve Bayes classifier that will predict the class of a road sign based on the three features above. In computing the Probability distributions for the Features above you assume that the sensors will not make any errors in detection (probably a bad assumption!). (b)
(5 points) Compute the Marginal distributions for feature F1 and present it as a probability distribution table.
Octagon
0.1
Rectangle
0.4
Diamond
0.2
Down Trian-
gle
0.1
Circle
0.2
(c)
(5 points) Compute the Marginal distribution for feature F2 and present as a probability distribution table.
Red
0.1
White
0.3
Yellow
0.2
Red and White
0.2
Green
0.1
Orange
0.1
(d)
(5 points) Compute the Marginal distribution for feature F3 and present as a probability distribution table.
White 0.3
Black 0.3
Red
0.2
None 0.2
(e)
(5 points) You begin inferencing with your system – which begins with the Probabilities and Log-
Probabilities for our Inferencing table from the Priors (As we did on slide 10 of lecture 10). The first evidence observed is from the Background color detector which indicates that a red background was detected. For each Y label {stop, speed 25, speed 35, pedestrian crossing, merge ahead, yield, do not enter, no parking, Austin city limits, and railroad crossing} compute the probability that the sign detected was of class Y and present in a probability distribution table:
Sign
P(Y|F1=Red)
Stop
0.66
Speed 25
0
Speed 35
0
Max Kotas
530000126
Pedestrian crossing
0
Merge ahead
0
Yield
0.495
Do not enter
0.165
No parking
0
Austin city limits
0
Railroad crossing
0
(f)
(4 points) A second piece of evidence arrives. The shape detector indicates that the shape of the detected object was a circle. With this new evidence, for each Y label {stop, speed 25, speed 35,
pedestrian crossing, merge ahead, yield, do not enter, no parking, Austin city limits, and railroad crossing}, compute the probability that the sign detected was of class Y and present in a probability distribution table:
Sign
P(Y|F1=red, F2=circle)
Stop
0
Speed 25
0
Speed 35
0
Pedestrian crossing
0
Merge ahead
0
Yield
0.75
Do not enter
0
No parking
0
Austin city limits
0
Railroad crossing
0
(g)
(5 points) You decide that over fall break you are going to take your robot-driven vehicle to Big Bend National Park. About 90 miles into your 541 mile journey, the Background color detector indicates that it has detected a sign with a green background…..and the sign detection system crashes, the vision system crashes, and the robot driven safely pulls into a hotel parking lot. From your knowledge of how the sign detection system works, and since you set the probabilities that the system uses, explain the likely cause of the system failure and how you might have avoided this problem.
The model trained so that the probability of seeing a green sign would be 0, and if we use naïve bayes theorem then then we would have to divide the equation by the probability of x which is the
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Max Kotas
530000126
sign color which = 0. It is impossible to divide by zero, but the programmer who wrote the code really should have accounted for that error.
Once you have completed your analysis and entered it on this form, don’t forget to turn this into a pdf file and upload it to canvas by 11:59PM on 10/06
Related Documents
Related Questions
4. Documents business requirements use-case narratives.for only one process
note: please i want Documents like this in pic
arrow_forward
I need help with the first part and Matlab for this problem
arrow_forward
K
mylabmastering.pearson.com
Chapter 12 - Lecture Notes.pptx: (MAE 272-01) (SP25) DY...
P Pearson MyLab and Mastering
Mastering Engineering
Back to my courses
Course Home
Scores
Course Home
arrow_forward
Chapter 12 - Lecture Notes.pptx: (MAE 272-01) (SP25) DY...
Scores
arrow_forward
You are a biomedical engineer working for a small orthopaedic firm that fabricates rectangular shaped fracture
fixation plates from titanium alloy (model = "Ti Fix-It") materials. A recent clinical report documents some problems with the plates
implanted into fractured limbs. Specifically, some plates have become permanently bent while patients are in rehab and doing partial
weight bearing activities.
Your boss asks you to review the technical report that was generated by the previous test engineer (whose job you now have!) and used to
verify the design. The brief report states the following... "Ti Fix-It plates were manufactured from Ti-6Al-4V (grade 5) and machined into
solid 150 mm long beams with a 4 mm thick and 15 mm wide cross section. Each Ti Fix-It plate was loaded in equilibrium in a 4-point bending
test (set-up configuration is provided in drawing below), with an applied load of 1000N. The maximum stress in this set-up was less than the
yield stress for the Ti-6Al-4V…
arrow_forward
Could 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
Motiyo
Add explanation
arrow_forward
this is a practice problem, not a graded assignment
arrow_forward
Can someone please help me to answer all of the following questions thank you!!
arrow_forward
I am having trouble with the folloiwng MATLAB code. I am getting an error that says "unrecognized function or variable 'numericalPropogatorOptions". I have the aerospace toolbox and the aerospace blockset added. what add on do I have to download to use that function. How do I make this code work?
% Define Keplerian Elements
a = 29599.8; e = 0.0001; i = 0.9774; Omega = 1.3549; w = 0; M = 0.2645;
[RECI, VECI] = Kepler2RV(a, e, i, Omega, w, M);
initialState = [RECI * 1e3; VECI * 1e3]; % Initial position (m) and velocity (m/s)
% Define constants
mu = 3.986004418e14; % Gravitational constant (m^3/s^2)
earthRadius = 6378.1363 * 1e3; % Earth radius in meters
j2 = 1.08263e-3; % J2 perturbation coefficient
% Define propagator options
propOptions = numericalPropagatorOptions('CentralBody', 'Earth', ...
'GravitationalParameter', mu, ...
'InitialState', initialState, ...
'OutputTimeStep', 300); % Output every 300 seconds
% Add perturbations
addGravityModel(propOptions, 'Degree', 2,…
arrow_forward
Help can only be sought via private Ed Discussion posts or instructor office hours.
- In all coding, use only functions covered in class. It will be considered a violation of the Academic Integrity Policy if you use
any build-in functions or operators of Matlab that calculate the inverse of a matrix, interpolations, spline, diff, integration, ode,
fft, pdes, etc.;
- You may reuse functions you yourself developed throughout this semester in this class or from solutions posted on Canvas for
this class.
Problem Description (CCOs #1, 2, 3, 4, 5, 6, 7, 8, 11, 12)
A water tank of radius R = 1.8m with two outlet pipes of radius r₁ = 0.05m and r2 installed at heights h₁ = 0.13m
and h₂ = 1m, is mounted in an elevator moving up and down causing a time dependent acceleration g(t) that must be
modeled as
g(t) = go+a1 cos(2π f₁t) + b₁ sin(2π f₁t) + a2 cos(2π f₂t) + b₂ sin(2π f₂t),
(1)
Figure 1: Water tank inside an elevator
The height of water h(t) in the tank can be modeled by the following ODE,…
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_forward
-The exam is open adopted textbook, open class notes (posted notes and solutions on the class' Canvas site only) and you may use
Matlab's build-in help system, but only to look up Matlab syntax questions;
- no collaboration is allowed; no help, including the tutoring center, may be sought to solve the problems;
- exam questions may only be asked to the instructor via private Ed Discussion posts or during the instructor's office hours;
- for non Matlab Grader problems, document all steps you took to solve the problem. This can be handwritten, but must be legible
for credit. If the problem states 'By hand', do not use any script/function to actually solve the problem, however, you may use a
non-programmable calculator or script/functions coded in this class to help in verifying the numerical results of individual steps;
- on Gradescope associate/select your answer pages with the corresponding problem numbers. Failure to do so may result in
no points given initially and will require a…
arrow_forward
For all the following problems,
a)
b)
4.
You need to show at least 3 iterations calculated manually with all steps.
You do not need to include the M.files for the bisection method (bisect.m) and for false position (falspos.m). You
must, however, show the command lines for the given functions with their variables and other parameters.
Zero-pressure specific heat of dry air
Mechanical engineers, as well as most other engineers, use thermodynamics extensively
in their work.
The following polynomial can be used to relate the zero-pressure specific heat of
dry air cp kJ/(kg K) to temperature (K):
11
0.99403 +1.671×10-4T + 9.7215-10-8T²-9.5838×10-
Cp
=
T3+1.9520×10-14T4
(a) Develop a plot of cp versus a range of T=0 to 1200 K.
(b) Use bisection to determine the temperature T that corresponds to a specific heat of 1.1 kJ/(kg K).
(c) What will be the value of T if you use false position method?
(d) What is the percentage error between the results of (b) and (c)?
For both methods use maximum…
arrow_forward
please show work
answer is D
arrow_forward
Projects A and B are mutually exclusive. The minimum attractive rate of return (MARR) is 12%.
Using rate of return analysis, which project should be selected?
If the image fails to load here, go to https://www.dropbox.com/s/ld6wctqieu8jgwp/ROR.jpg
Year
0
1
2
3
4
ROR
A
- $750
$200
$200
$200
$600
17.68%
B
- $1,150
$300
$350
$400
$700
16.44%
O Project A
O Project B
O Both Project A and B
O Select none of the project.
O Insufficient information to make a decision.
B-A
- $400
$100
$150
$200
$100
13.69%
arrow_forward
TRUP
TUE FLE
FM
AutoSave
Hwk-6a.MechanialProperties-ElasticRegion • Last Modified: Mon at 9:05 AM -
O Search (Alt+Q)
Torialai Stanikzai
On
TS
File
Home
Insert
Draw
Design
Layout
References
Mailings
Review
View
Help
O Find -
S Replace
Times New Roma - 12
A A Aav Ao
AaBbCcDc AaBbCcDc AaBbC AaBbCcC AaB AaBbCcC AaBbCcDa AaBbCcDa AaBbCcDa
B COPY
S Format Painter
Paste
BIUab x, x² A evA
1 Normal
I No Spac..
Heading 1
Heading 2
Title
Subtitle
Subtle Em..
Emphasis
Intense E.
A Select v
Dictate
Edi
clipboard
Paragraph
Styles
Editing
Voice
Ed
Font
5.
Consider the difference between tension and compression. We defined
mathematical expression for o, e, and v in tension. How are these expressions affected
when applied to compression?
arrow_forward
HW Matlab 1) Create a variable ftemp to store a temperature in degrees Fahrenheit (F). Write m-file to convert this to degrees Celsius and store the result in a variable ctemp. The conversion factor is C = (F —32) * 5/9. 2) Write m-file to generate a matrix of random integers of size 100 by 100 their values between 15 to 80. 3) Free fall of objects is given by y =5mgt? where a is the acceleration, v is the velocity, y is the distance, m is the mass of the object, g is the gravitational acceleration. Plot the distance and velocity of the object for 15 seconds after its fall from rest (y = 0). Take m = 0.2 kg.
arrow_forward
I want to run the SGP4 propagator for the ISS (ID = 25544) I got from spacetrack.org in MATLAB. I don't know where to get the inputs of the function. Where do I get the inFile and outFile that is mentioned in the following function.
% Purpose:
% This program shows how a Matlab program can call the Astrodynamic Standard libraries to propagate
% satellites to the requested time using SGP4 method.
%
% The program reads in user's input and output files. The program generates an
% ephemeris of position and velocity for each satellite read in. In addition, the program
% also generates other sets of orbital elements such as osculating Keplerian elements,
% mean Keplerian elements, latitude/longitude/height/pos, and nodal period/apogee/perigee/pos.
% Totally, the program prints results to five different output files.
%
%
% Usage: Sgp4Prop(inFile, outFile)
% inFile : File contains TLEs and 6P-Card (which controls start, stop times and step size)
% outFile : Base name for five output files
%…
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you

Principles of Heat Transfer (Activate Learning wi...
Mechanical Engineering
ISBN:9781305387102
Author:Kreith, Frank; Manglik, Raj M.
Publisher:Cengage Learning
Related Questions
- 4. Documents business requirements use-case narratives.for only one process note: please i want Documents like this in picarrow_forwardI need help with the first part and Matlab for this problemarrow_forwardK mylabmastering.pearson.com Chapter 12 - Lecture Notes.pptx: (MAE 272-01) (SP25) DY... P Pearson MyLab and Mastering Mastering Engineering Back to my courses Course Home Scores Course Homearrow_forward
- Chapter 12 - Lecture Notes.pptx: (MAE 272-01) (SP25) DY... Scoresarrow_forwardYou are a biomedical engineer working for a small orthopaedic firm that fabricates rectangular shaped fracture fixation plates from titanium alloy (model = "Ti Fix-It") materials. A recent clinical report documents some problems with the plates implanted into fractured limbs. Specifically, some plates have become permanently bent while patients are in rehab and doing partial weight bearing activities. Your boss asks you to review the technical report that was generated by the previous test engineer (whose job you now have!) and used to verify the design. The brief report states the following... "Ti Fix-It plates were manufactured from Ti-6Al-4V (grade 5) and machined into solid 150 mm long beams with a 4 mm thick and 15 mm wide cross section. Each Ti Fix-It plate was loaded in equilibrium in a 4-point bending test (set-up configuration is provided in drawing below), with an applied load of 1000N. The maximum stress in this set-up was less than the yield stress for the Ti-6Al-4V…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
- I am having trouble with the folloiwng MATLAB code. I am getting an error that says "unrecognized function or variable 'numericalPropogatorOptions". I have the aerospace toolbox and the aerospace blockset added. what add on do I have to download to use that function. How do I make this code work? % Define Keplerian Elements a = 29599.8; e = 0.0001; i = 0.9774; Omega = 1.3549; w = 0; M = 0.2645; [RECI, VECI] = Kepler2RV(a, e, i, Omega, w, M); initialState = [RECI * 1e3; VECI * 1e3]; % Initial position (m) and velocity (m/s) % Define constants mu = 3.986004418e14; % Gravitational constant (m^3/s^2) earthRadius = 6378.1363 * 1e3; % Earth radius in meters j2 = 1.08263e-3; % J2 perturbation coefficient % Define propagator options propOptions = numericalPropagatorOptions('CentralBody', 'Earth', ... 'GravitationalParameter', mu, ... 'InitialState', initialState, ... 'OutputTimeStep', 300); % Output every 300 seconds % Add perturbations addGravityModel(propOptions, 'Degree', 2,…arrow_forwardHelp can only be sought via private Ed Discussion posts or instructor office hours. - In all coding, use only functions covered in class. It will be considered a violation of the Academic Integrity Policy if you use any build-in functions or operators of Matlab that calculate the inverse of a matrix, interpolations, spline, diff, integration, ode, fft, pdes, etc.; - You may reuse functions you yourself developed throughout this semester in this class or from solutions posted on Canvas for this class. Problem Description (CCOs #1, 2, 3, 4, 5, 6, 7, 8, 11, 12) A water tank of radius R = 1.8m with two outlet pipes of radius r₁ = 0.05m and r2 installed at heights h₁ = 0.13m and h₂ = 1m, is mounted in an elevator moving up and down causing a time dependent acceleration g(t) that must be modeled as g(t) = go+a1 cos(2π f₁t) + b₁ sin(2π f₁t) + a2 cos(2π f₂t) + b₂ sin(2π f₂t), (1) Figure 1: Water tank inside an elevator The height of water h(t) in the tank can be modeled by the following ODE,…arrow_forwardHello 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_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Principles of Heat Transfer (Activate Learning wi...Mechanical EngineeringISBN:9781305387102Author:Kreith, Frank; Manglik, Raj M.Publisher:Cengage Learning

Principles of Heat Transfer (Activate Learning wi...
Mechanical Engineering
ISBN:9781305387102
Author:Kreith, Frank; Manglik, Raj M.
Publisher:Cengage Learning