Answered step by step
Verified Expert Solution
Question
1 Approved Answer
so this code should generate 5 graphs but it only generates 4 graphs and these errors keeps coming up that you see on the picture.
so this code should generate graphs but it only generates graphs and these errors keeps coming up that you see on the picture. I need figure graph to come up Could you please amek sure that all the errors are gone and all graphs that includes figure for come up Please use matlab to fix the code. clearclc EGME : Digital Computation Project Part : Randomly Generated Data Step : First we need a date vector from January st to December ststartdate datetime;enddate datetime;datevector startdate:enddate; Step : Trying to find associated days of the weekdaysofweek daydatevector, 'name'; Step : Here is how to make a random temperature vectortemperaturemax ;temperaturemin ;temperaturevector temperaturemax temperaturemin randsizedatevector temperaturemin; Step : Creating a string for the weekend daysweekenddays stringdatevectorweekdaydatevector weekdaydatevector; Step : Development of more substance to the reporta Here is a linear plot for weekends in which the temperature is over weekendindices findtemperaturevector & weekdaydatevector weekdaydatevector;figure;plotdatevectorweekendindices temperaturevectorweekendindiceso;titleWeekend Temperatures over ;xlabelDate;ylabelTemperature;b This section is a bar plot showing how many times the temperature is below in each monthmonths uniquemonthdatevector;temperaturebelowcount zerossizemonths;for i :numelmonthsmonthindices findmonthdatevector monthsi;temperaturebelowcounti sumtemperaturevectormonthindices;endfigure;barmonths temperaturebelowcount;titleCount of Days with Temperature Below in Each Month';xlabelMonth;ylabelCount;c Here we have two linear plots showing the maximum and minimum temperature in each monthmaxtemperaturemonthly accumarraymonthdatevector temperaturevector', @max;mintemperaturemonthly accumarraymonthdatevector temperaturevector', @min;figure;plotmonths maxtemperaturemonthly, o 'DisplayName', 'Max Temperature';hold on;plotmonths mintemperaturemonthly, o 'DisplayName', 'Min Temperature';hold off;titleMonthly Maximum and Minimum Temperatures';xlabelMonth;ylabelTemperature;legendLocation 'best'; Part : Imported Data Step : Import the two datasets and combine them into one global datasetdata readtableCarsAggregated.csv; Import the first datasetdata readtableVansAggregated.csv; Import the second dataset Combine the datasetscombineddata data; data; Step a: Create a bar chart showing how many cars use distinct fuel types Preprocess data: remove missing or empty values from 'FuelType' columnvalidindices ~ismissingcombineddata.FuelType & ~strcmpcombineddata.FuelType, ; Filter the combined data based on valid indicesvalidfueldata combineddatavalidindices, :; Get unique fuel types and count occurrencesfueltypes, ~ fueltypeindices uniquevalidfueldata.FuelType;fuelcounts histcountsfueltypeindices, :numelfueltypes; Plot the bar chartfigure;bar:numelfueltypes fuelcounts;titleNumber of Cars Using Distinct Fuel Types';xlabelFuel Type';ylabelNumber of Cars';xticks:numelfueltypes;xticklabelsfueltypes; Step b: Create a scatter plot showing the weighted CO Percentage for each carsortedmanufacturers, manufacturerindices sortcombineddata.Manufacturer; Sort manufacturers alphabeticallysortedCOpercentage combineddata.COPercentagemanufacturerindices; Sort CO Percentage accordingly Plot scatter plotfigure;scatter:numelsortedCOpercentage sortedCOpercentage;hold on; Fit a polynomial of degree xvalues :numelsortedCOpercentage; Ensure xvalues is a column vectorsortedCOpercentage sortedCOpercentage:; Convert to column vectorp polyfitxvalues, sortedCOpercentage, ;yfit polyvalp xvalues;plotxvalues, yfit, r 'LineWidth', ;titleWeighted CO Percentage for Each Car Sorted by Manufacturer;xlabelCar Sorted by Manufacturer;ylabelWeighted CO Percentage';legendData Points', 'Line of Best Fit Degree 'Location', 'best';hold off;
so this code should generate graphs but it only generates graphs and these errors keeps coming up that you see on the picture. I need figure graph to come up Could you please amek sure that all the errors are gone and all graphs that includes figure for come up Please use matlab to fix the code.
clearclc EGME : Digital Computation Project Part : Randomly Generated Data Step : First we need a date vector from January st to December ststartdate datetime;enddate datetime;datevector startdate:enddate; Step : Trying to find associated days of the weekdaysofweek daydatevector, 'name'; Step : Here is how to make a random temperature vectortemperaturemax ;temperaturemin ;temperaturevector temperaturemax temperaturemin randsizedatevector temperaturemin; Step : Creating a string for the weekend daysweekenddays stringdatevectorweekdaydatevector weekdaydatevector; Step : Development of more substance to the reporta Here is a linear plot for weekends in which the temperature is over weekendindices findtemperaturevector & weekdaydatevector weekdaydatevector;figure;plotdatevectorweekendindices temperaturevectorweekendindiceso;titleWeekend Temperatures over ;xlabelDate;ylabelTemperature;b This section is a bar plot showing how many times the temperature is below in each monthmonths uniquemonthdatevector;temperaturebelowcount zerossizemonths;for i :numelmonthsmonthindices findmonthdatevector monthsi;temperaturebelowcounti sumtemperaturevectormonthindices;endfigure;barmonths temperaturebelowcount;titleCount of Days with Temperature Below in Each Month';xlabelMonth;ylabelCount;c Here we have two linear plots showing the maximum and minimum temperature in each monthmaxtemperaturemonthly accumarraymonthdatevector temperaturevector', @max;mintemperaturemonthly accumarraymonthdatevector temperaturevector', @min;figure;plotmonths maxtemperaturemonthly, o 'DisplayName', 'Max Temperature';hold on;plotmonths mintemperaturemonthly, o 'DisplayName', 'Min Temperature';hold off;titleMonthly Maximum and Minimum Temperatures';xlabelMonth;ylabelTemperature;legendLocation 'best'; Part : Imported Data Step : Import the two datasets and combine them into one global datasetdata readtableCarsAggregated.csv; Import the first datasetdata readtableVansAggregated.csv; Import the second dataset Combine the datasetscombineddata data; data; Step a: Create a bar chart showing how many cars use distinct fuel types Preprocess data: remove missing or empty values from 'FuelType' columnvalidindices ~ismissingcombineddata.FuelType & ~strcmpcombineddata.FuelType, ; Filter the combined data based on valid indicesvalidfueldata combineddatavalidindices, :; Get unique fuel types and count occurrencesfueltypes, ~ fueltypeindices uniquevalidfueldata.FuelType;fuelcounts histcountsfueltypeindices, :numelfueltypes; Plot the bar chartfigure;bar:numelfueltypes fuelcounts;titleNumber of Cars Using Distinct Fuel Types';xlabelFuel Type';ylabelNumber of Cars';xticks:numelfueltypes;xticklabelsfueltypes; Step b: Create a scatter plot showing the weighted CO Percentage for each carsortedmanufacturers, manufacturerindices sortcombineddata.Manufacturer; Sort manufacturers alphabeticallysortedCOpercentage combineddata.COPercentagemanufacturerindices; Sort CO Percentage accordingly Plot scatter plotfigure;scatter:numelsortedCOpercentage sortedCOpercentage;hold on; Fit a polynomial of degree xvalues :numelsortedCOpercentage; Ensure xvalues is a column vectorsortedCOpercentage sortedCOpercentage:; Convert to column vectorp polyfitxvalues, sortedCOpercentage, ;yfit polyvalp xvalues;plotxvalues, yfit, r 'LineWidth', ;titleWeighted CO Percentage for Each Car Sorted by Manufacturer;xlabelCar Sorted by Manufacturer;ylabelWeighted CO Percentage';legendData Points', 'Line of Best Fit Degree 'Location', 'best';hold off;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started