Click here for data and code files necessary to complete the practice problems.
The provided text file (
readings.txt) contains a timestamp broken up into year, month, day, hour, minute, second, and timezone components, as well as a reading from a sensor. Write a script that reads the data from the file using the
doublewith a variable name of
viewdata.mat) contains a 19-by-3 matrix
viewdatawith the following columns:
viewPctcontaining the percentage viewed for each variable according to the formula: Percentage viewed = (Minutes watched / Views) / (Video length).
TData.mat) contains temperature data reported by weather stations instance in time. The contents of the data file are:
Write a MATLAB script to load the data from the file and produce a contour plot similar to the one below with the temperature stations. Use the
griddata function with
'v4' as the interpolation method to estimate the temperatures for the x-y spatial grid points.
fwhich accepts a (possibly vector valued) numeric input and returns a (possibly vector valued) numeric output according to the mathematical formula f(x) = x^2 - sin(x). Use this function along with the
fminsearchfunction to find the local minimum value near the initial value near
x0 = 0.5.Store the local minimizing value and the corresponding function value in the variables
viewImageaccepts an image and a variable number of parameter name/value pairs as shown in the function heading:
function viewImage (I, varargin)
Do not write any implementation beyond the code required to perform the validation.
(diceSimulation.m)runs a simulation of rolling six, 6-sided dice and calculating the sum. The simulation is repeated 1,000,000 times to create a histogram of the probability distribution as shown below.
The code produces the correct result, but can be improved to run faster. Rewrite the script such that the simulation produces the same results with 1,000,000 trials, a histogram of the results is created, and a faster execution time.
The figure illustrates on result from running the script. Solutions should have a similar distribution.
(LoadData.m)loads data from an impact simulation, and uses the
plotyyfunction to plot position on the left y-axis and velocity on the right y-axis. Using the outputs from the
plotyyfunction, modify the figure to make it look as shown in the figure below.
y = amplitude*sin(2*pi*frequency*x)on the interval defined by
Additionally, display a plot with the default values for amplitude and frequency upon starting the application.