Report Lab02
Report Lab02
m)
In this ques on, we analyze the performance and output of the MATLAB
func on ex2fun(a, m). This func on is designed to process a column vector a
by averaging groups of m consecu ve elements to create a new vector b. this
func on will provide us the sta s cal measurements. The objec ve is to
explore how parameter m's choice influences these sta s cal measures.
To find different sta s cal value I used inbuild func on like length, min, max,
mean, std.
La er a histogram of the elements in b was generated using the hist(). The
histogram provided insight into the distribu on of values in b:
The histogram revealed that the elements in b are approximately normally
distributed,
understand the impact of the parameter I run the func on with m=4,6,8,10
as we can see a er increasing the value of m standard devia on decreases. by a decrease in the
standard devia on as m increases, leading to more consistent averages and a less variable dataset.
In this statement problem we analyse Bindu's milk shop opera ons over the
past two years, we computed the daily profit based on single-day sales data.
For each of the 730 days, we applied simple mathema cal formula to calculate
daily profit and sotored it in a array. For sta s cal analysis purpose,
This report compares the sta s cal measures of daily profit for Bindu’s milk
shop before and a er implemen ng a two-day storage rule.
The mean profit is iden cal (Rs 2014.07) under both scenarios. This indicates that
the overall average profitability remains consistent regardless of the storage policy.
The standard devia on increased with two-day storage. This suggests that while
the mean profit remains the same, the variability of profits has increased. This
could be due to fluctua ons in how well excess milk is managed and sold over an
extended period.
The minimum profit decreased with the two-day storage policy. This indicates that
there are now more instances of lower profits or losses, poten ally due to unsold
milk being sold at a lower price to the confec oner.
Both scenarios have the same maximum profit of Rs 2750.00. This consistency
suggests that the highest profit poten al is not affected by the storage policy.
The comparison reveals that while the mean profit remains the same across
both scenarios, the two-day storage policy introduces greater variability in daily
profits, as indicated by the increased standard devia on and lower minimum
profit.
Problem 4 (Vending Milk Con nued..) ex4.m
The data of demand and supply is not given to me but the distribu on of both
variables is given that both supply and demand are uniformly distributed
between 20 and 40 liters. The simula on uses the rand() func on to generate
daily supply and demand values. The goal is to compute and track the average
revenue over me,
simula on was run for 2000 days. Key findings are as follows:
The results showed fluctua ons in the average revenue as expected due to the random
nature of supply and demand.
Here are the results over the me;
The average revenue is increasing with a very less amount, showing that the milk
shop’s revenue management is improving.
The average revenue is becoming more stable as more days are considered, with only
small changes, indica ng that the average is se ling down.
This stable average revenue shows that the milk shop's earnings are consistent in the
long run, even with daily changes in supply and demand.
Here is the plot for visual analysis see how revanue is ge ng steady with
increasing number of days
The plot of average revenue as a func on of days shows a generally stable trend with
minor fluctua ons. This stability indicates that the average revenue converges over me,
reflec ng the balance between random fluctua ons in supply and demand.
Problem 5.
(a) Uniform Distribu on with rand() testrand.m
In this problem we have to test whether numbers generated by
MATLAB's rand() func on are uniformly distributed between 0 and 1.
We generated random values using rand() for different sample sizes: 10,
1,000, and 1,000,000.
Histograms of these values were plo ed to visualize the distribu on.
Observa on:
For n = 10: The histogram showed considerable variability and was not smooth,
reflec ng the small sample size.
For n = 1,000: The histogram began to approach a more uniform distribu on, with
bars becoming more evenly distributed across the range.
For n = 1,000,000: The histogram appeared nearly flat and uniform, confirming that
as the sample size increases, the distribu on of values generated by rand()
approximates a uniform distribu on between 0 and 1.
Part(b)
(b) Exponen al Distribu on with exprnd() testexprnd.m
In this sec on we have to test whether numbers generated by MATLAB's
exprnd() func on are exponen ally distributed (we have taken average
value 0.25). We generated random values using exprnd() for different
sample sizes: 10, 1,000, and 1,000,000.
We generated values using exprnd() which follows an exponen al
distribu on with a mean of 0.25.
Histogram for different different sample size are given for visual analysis;
The histogram of values generated by exprnd() displayed a distribu on
that was heavily skewed to the right, with a high concentra on of
values near zero and a long tail extending towards higher values.
Unlike rand(), which produces a uniform distribu on, exprnd() generates values
that follow an exponen al distribu on. This results in a histogram with a
characteris c right-skewed shape, indica ng that small values are more
frequent, while larger values are less common.