Ask MATLAB Expert

FUNCTION OF A RANDOM VARIABLES

Problem Description

A cell-phone carrier offers the following monthly options:

  • Base fee of $20 (no data);
  • $7for the first 10 Gbytes of data;
  • An extra $19 for the next 10 GBytes of data use, i.e. you pay $46 if you exceed 10 Gbytes, but do not get to 20 Gbytes;
  • $15 extra for the next 10 GBytes;
  • $11 extra for the next 10 GBytes;
  • $7 extra for the next 10 GBytes;
  • $3 extra for the next 10 GBytes (we are in the 50-60 Gbyte range);
  • When you exceed 60 Gbytes of data use, you get charged a flat fee of $100 (including the base fee) until you get to 100 Gbytes.
  • You may not exceed 100 Gbytes, i.e. at this point your service is stopped until the following month.

Assume X is a random variable that represents how many Gigabytes of data a person uses per month, rounded up to the nearest multiple of 10 Gbytes. The units of X are 10 GBytes, e.g. X = 3 means the person used more than 20, but less than 30 Gbytes.

Note: The range of X is, then, SX = {0, 1, 2,..., 10}.

Assume random variable Y represents how much a person pays per month for using this carrier's service. X=0 implies the client is only paying for the base fee, without any data plan.

a. Using Matlab'spolyfit(), find a function Y = g(X) for the amount, in dollars, for each of the plans. This function should be expressed as follows:

              {                     a,   0
Y=g(X)= { (aX2 + cX + d,   X = 1,2,3,4,5,6
              {                     e,   X = 7,8,9,10

In this function, Xis an integer between 0 and 10, and it specifies now many 10s of Gigabytes a person is choosein and it specifies the number of pounds with rounding up for a fraction.

Hint: Should you use ever value of X when invoking polyfit()?

Find the range of Y, SY, and plot it vs. the range of X.

b. Assume customers are equally likely to use the first four plans, i.e. the plan with no data and the 10, 20, and 30 Gbyte plans. The plans with 40, 50, and 60 GByte are one third as likely as the first four. The 100 Gbyte plan is one fourth as likely as the 10 GByteplan. Assume the customers choice is given by random variable X. Derive the PMF and calculate the expected value and variance of X.Make a plot of the PMF of X, and include the expected value and the variance in the title, using the figure at the top of the next page as an example. Note: The figure does not correspond to the PMF of X described in this handout.

704_Function.jpg

Note 1: The line function can be used to generate a vertical line.
Note 2: Explore the LineWidth property in the plot function. It is useful for changing the width of the curves in your graphs, and can be tweaked to make a plot more readable (i.e. prettier!).

c. Using the function derived in part a), derive by hand the PMF of random variable Y (i.e., the random variable that is equal to the amount of money a customer will pay given a specific plan), and calculate the expected value of Y and the variance of Y. You should calculate the expected value via two methods:

E[Y] = ∑y.P[Y=y] (summing over the range of Y)
E[Y] = ∑g(X).P[X=x] (summing over the range of X)
Both methods should result in the same answer.

d. Write a Matlab function, say find_pmf_Y(), that will take as arguments the following:
The range of X, SX.
The range of Y, SY.
The PMF of X.
The function should return the PMF of Y, and should be identical to what you derived in part c). Invoke the function to get the PMF of Y.

e. Write a Matlab function say, exp_val_Y(), that will take four arguments:
The range of Y, SY.
The PMF of X.
The PMF of Y.
Function g(X) = Y.
The function should return the expected value of Y using the two same methods used in part c.

f. Plot the PMF of Y, using the graph at the top of this page as an example.

g. Generate a random vector of N = 100,000 customers, say x_vec, that corresponds to PX(x), described in part b). This means that, for example, customers that use the 10 Gb plan should be twice as likely to occur than those that use the 50 Gb plan, and four times as likely as the 100 Gb plan users. Plot the normalized histogram of vector x_vec. If should approximate the PMF plotted in part b). At the title of the histogram plot, indicate the sample mean of the vector x_vec,μX.

h. Generate a random vector, say y_vec, that corresponds to every value in vector x_vec. Calculate the sample mean, μY, using vector y_vec. Plot the histogram of the random vector, and indicate the sample mean in the title. This histogram should approximate the PMF you plotted in part f). What is the meaning of the μY?

Note: Starting in part b), your Matlab functions should not be specific to the g(X) you derived in part a). When you turn in your code, I will run it with a different values for PX(x), SX, and SY. The reason for this is to tests various sample plans. For example, will the plan given in the problem description yield more gains for a different PMF for X? Or, say we keep the same PMF for X, will a slight alteration of the plan result in better earnings?

Thus, in your code (at least parts b) onwards), it should be easy to modify the PMF of X and the function Y=g(X).

Deliverables:
You should turn in the following:
Formal lab report (printed).
All matlab code with clear and specific instructions as to how to modify your code so that I can test arbitrary values for the PMF of X and for Y = g(X). To make it more manageable, let's assume that the range of X will never change, i.e. SX = {0, 1, 2,..., 10}.

MATLAB, Engineering

  • Category:- MATLAB
  • Reference No.:- M92690894
  • Price:- $70

Priced at Now at $70, Verified Solution

Have any Question?


Related Questions in MATLAB

Assignment - matlab programmingusing appropriate matlab

Assignment - MatLab Programming Using appropriate MatLab syntax, write the code required to analyse and display the data as per the problem description. The order of the MatLab Program should be as follows: Variables and ...

Assignment details -need to write a code for connecting

Assignment Details - Need to write a code for connecting segments (Lines) a special case of TSP. The problem is to connect lines in 2d/ 3d space with path obstructions. Can you help me write the code for this? Hope you m ...

Assignment -we have daily gridded rainfall data of 40 years

Assignment - We have daily gridded rainfall data of 40 years and structure of the dataset is like below; Lat = [6.5:0.25:38.5]; Lon = [66.5:0.25:100]; Rainfall (135x129x365x40) (Lon, Lat, days, years). Now, we looking fo ...

Question a safe prime is a prime number that can be written

Question : A safe prime is a prime number that can be written in the form 2p + 1 where p is also a prime number. Write a MATLAB script file that finds and displays all safe primes between 1 and 1000.

Question - verify the attached paper with matlab and get

Question - Verify the attached paper with matlab and get all the results in the paper and explain step by step the matlab code. Paper - Improving Massive MIMO Belief Propagation Detector with Deep Neural Network. Attachm ...

Assignment -data is given on which want to do computational

Assignment - Data is given on which want to do computational production planning using Metaheuristic MATLAB Programming: 1) Ant Colony Algorithm on both Partial and Total Flexible Problem. 2) Bee Algorithm on both Partia ...

What comparison of means test was used to answer the

What comparison of means test was used to answer the question

Question 1 manipulate spectral imagehyperspectral images

Question 1. Manipulate spectral image Hyperspectral images can be seen as a generalisation of normal colour images such as RGB images. In a normal RGB colour image, there are 3 channels, i.e. channels for red colour, gre ...

Assignment -matlab codes and simulated model in

Assignment - Matlab codes and simulated model in simulink/matlab and truetime. 1. Matlab codes and simulink model for pid controller optimization using particle swarm optimization (PSO) my plant is integer order 1000/(s^ ...

Assignment matlab programmingusing appropriate matlab

Assignment: MatLab Programming Using appropriate MatLab syntax, write the code required to analyse and display the data as per the problem description. The order of the MatLab Program should be as follows: Variables and ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As