Write a script called plot_pdf_graphs.m that creates 3 distinct graphs using Mat
ID: 3661732 • Letter: W
Question
Write a script called plot_pdf_graphs.m that creates 3 distinct graphs using Matlab with the following features :
(a) Generate a row vector x1 of 10 evenly spaced values with first value equal to -3 and last value equal to 3. Plot the probability density function of a uniform distribution U(1.33,2.54) for the range of values in x1. Give a title, labels to the x-axis and y-axis on the graph.
(b) Generate a row vector x2 of 50 evenly spaced values with first value equal to -2.5 and last value equal to 6. Plot the probability density function of a normal distribution N (2.21, 1.15) for the range of values in x2. Give a title, labels to the x-axis and y-axis on the graph.
(c) Generate a row vector x3 of 50 evenly spaced values with first value equal to -0.1 and last value equal to 10. Plot the probability density function of an exponential distribution E(3.48) for the range of values in x3. Give a title, labels to the x-axis and y-axis on the graph.
Explanation / Answer
a)
pd1 = makedist('Uniform');
x = linspace(-3,3,10);
y = pdf(x,pd1);
plot(x,y);
b)
x = linspace(-2.5,6,50);
y = normpdf(x,2.21,1.15);
plot(x,y);
c)
x = linspace(-0.1,10,50);
y = exppdf(x,3.48);
plot(x,y)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.