Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
4 views

ME207 MATLAB Assignment

Uploaded by

yemre525252
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

ME207 MATLAB Assignment

Uploaded by

yemre525252
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

ME207 MATLAB assignment # 1 – Fall2024

1) (10 points) During Halloween, a group of children collects candies in their trick-or-treat
bags. They dump all the collected candies into a large bowl, which now contains 30
candies, consisting of:
• 12 chocolate candies
• 18 gummy bear candies
The children then decide to randomly eat 8 candies from the bowl. Simulate the selection
of candies 1,000 times.

a) What do you expect the average number of chocolate candies selected to


be? Is this value consistent with the analytical calculation of the expected
value of this probability distribution function?

b) In what percentage of the 1,000 trials were exactly 5 out of the 8 selected
candies chocolate? Does this result align with the analytical calculation
based on the formula for this probability distribution?

2) (20 points) An experimental treatment is being tested for a type of cancer that is typically
fatal within 12-15 months if left untreated. In the study, 5000 patients receive the treatment
and are monitored over a 5-year period. Let 𝑋 represent the survival time of a randomly
selected patient after receiving the treatment. (If a patient is still alive at the conclusion of
the study, 𝑋 is recorded as 5 for that patient.)
Create a script that reads the patient.data file, which contains lifespan data for the
selected 5000 patients and

a) compute the mean, variance and standard deviation of the data.

b) Plot a histogram of the data. Set the histogram so each bin has width 0.1 years.

c) Using your answers in (a) and (b), write a short paragraph summarizing the data in a
useful way.
d) Based on the (c), what are your conclusions about the effectiveness of the treatment?
What recommendations would you make for avenues of further research?
3) (20 points) This assignment requires you to have MATLAB with the Statistics and
Machine Learning Toolbox enabled. Our university has a license for this toolbox, so you
should be able to access it without any issues.

A manufacturing company produces metal rods that are supposed to be 10 cm in length.


Due to variability in the production process, the lengths of the rods are normally distributed
with a mean of 10 cm and a standard deviation of 0.05 cm.

a) Write a MATLAB script that plots the probability density function (PDF) of the rod
lengths between 9.8 cm and 10.2 cm. Use the normpdf function to generate the PDF
and label the plot axes appropriately.

b) Using the normcdf function, compute the probability that a randomly selected rod
has a length between 9.95 cm and 10.05 cm. Display this probability in your script.

c) Suppose the company wants to set quality control limits such that 95% of the rods
produced are within the specification limits. Use the norminv function to determine
the lengths that correspond to the 2.5th and 97.5th percentiles. Display these
specification limits in your script.

d) Simulate the production of 5000 rods by generating random rod lengths from the
normal distribution with mean 10 cm and standard deviation 0.05 cm using
the normrnd function. Plot a histogram of the simulated rod lengths and compare it
with the PDF of the normal distribution. Overlay the PDF plot on top of the
histogram.

You might also like