0% found this document useful (0 votes)
9 views12 pages

Report Lab02

Uploaded by

sarveshayaam2023
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views12 pages

Report Lab02

Uploaded by

sarveshayaam2023
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Problem 2. ( ex2fun.

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.

Here is the histogram created on the value of b


the histogram will show how the values in b are distributed.
These are the histogram with different different values of m, we can easily observe that the
distribu on of values of b is looks like normally distributed ( as m is less then the number of
values in b is more that is why for les value of m the more looks like a normally distributed)
Problem 3 (Vending Milk)
( there are two MATLAB file for this ques on ex3_1_2.m and ex3_3_4.m )

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.

Here are the measurements:

 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.

(c) Discarding Values and Histogram of Remaining Values


testexprnd_new.m
analyze the effect of discarding values smaller than 0.5 when using exprnd(),
and to visualize the remaining values. We generated 50,000 values using
exprnd() and discarded values smaller than 0.5. The remaining values were
adjusted by subtrac ng 0.5 and their histogram was plo ed.
Here are the result with a frac on of discarded values:

Create a histogram of the adjusted values.This histogram will show the


distribu on of these adjusted values.
The exponen al distribu on is heavily right-skewed, meaning that it produces
many small values and fewer large ones. By discarding values smaller than 0.5,
we are removing a significant por on of the distribu on's mass. Discarding the
smaller values and then shi ing the remaining values to the le (by subtrac ng
0.5) will change the shape of the distribu on. This will result in a histogram
that s ll has a right-skewed shape but is now concentrated on a different range
of values.
In this exercise we learnt how transforma ons (such as discarding values and
shi ing the remaining ones) affect the shape and characteris cs of a
distribu on. It helps in understanding how data manipula on can change the
sta s cal proper es of a dataset, which is important in fields like data science
and sta s cal analysis.

You might also like