- (4) Plot a funnel shaped spiral in 3D: [x; y; z] = [t sin(t); t cos(t); t] for t = [0; 10]. (Use plot3) Use an appropriate sampling to get smooth curves.
Thursday, December 31, 2015
Plot a funnel shaped spiral in 3D: [x; y; z] = [t sin(t); t cos(t); t] for t = [0; 10]. (Use plot3) Use an appropriate sampling to get smooth curves.
Plot the functions f(x) = x; g(x) = x3; h(x) = ex and z(x) = ex2over the interval [0; 4]. Use an appropriate sampling to get smooth curves. Describe your plots by using the functions: xlabel,ylabel,title.
- (3) Plot the functions f(x) = x; g(x) = x3; h(x) = ex and z(x) = ex2over the interval [0; 4]. Use an appropriate sampling to get smooth curves. Describe your plots by using the functions: xlabel,ylabel,title.
Plot a circle with the radius r = 2, knowing that the parametric equation of a circle is [x(t); y(t)] = [rcos(t); rsin(t)] for t = [0; 2]
- (2) Plot a circle with the radius r = 2, knowing that the parametric equation of a circle is [x(t); y(t)] = [rcos(t); rsin(t)] for t = [0; 2]
Make a plot connecting the coordinates: (2; 6); (2:5; 18); (5; 17:5); (4:2; 12:5) and (2; 12) by a line.
- (1) Make a plot connecting the coordinates: (2; 6); (2:5; 18); (5; 17:5); (4:2; 12:5) and (2; 12) by a line.
- Matlab code
Wednesday, December 30, 2015
For this assignment you will plot the probability mass function and the cumula- tive distribution function of the binomial distribution an geometric distribution
Instructions
- For assignment 2 we generated the pmf of the Binomial Distribution (recall: f(x) = (n choose x)( p^(x) ) * (1 - p) (n - x) for x = 0; 1; 2; : : : ; 10, [in Matlab terms: f(x) = nchoosek( n, x ) * p^x * (1-p)^(n-x) ]).
- For this assignment you will plot the probability mass function and the cumula-tive distribution function of the binomial distribution for p = 0:15; 0:33; 0:5; 0:66; 0:85 and n = 10. How does the shape change as a function of p?
- The pmf of the Geometric Distribution is given as : f(x) = ((1- p)^(x-1 ))p [in Matlab: (1-p)^(x-1) * p], for x = 1; 2; : : :. Plot the probability mass function and the cumulative distribution function of a geometric distribution with p = 0:15; 0:33; 0:5; 0:66; 0:85 for x = 1; 2; : : : ; 15. How does the shape change as a function of p?
- Binomial Probability Cumulative Distribution
![]() |
| 1p =0.15 |
![]() |
| 2p = 0.33 |
![]() |
| 3p = 0.5 |
![]() |
| 4p = 0.66 |
![]() |
| 5p = 0.85 |
- Binomial Probability Mass Function
![]() |
| 1p = 0.15 |
![]() |
| 2p =0.33 |
![]() |
| 3p = 0.5 |
![]() |
| 4p =0.66 |
Geometric Distribution
- Probability Cumulative function
- Probability Mass Function
MatLab problems
Problems
Write Matlab code that does the following:
(1) Create a vector of the numbers 1 to 100
(2) Create a vector of the even numbers between 1 and 49 in reverse order (that
is [48, 46, . . . , 2])
(3) Assign the matrix
| 1 2 3 |
| 4 5 6 |
| 3 2 1 |
to a variable a
(4) Add the rst column of a to the second column of a
(5) Add 3 to every element of a
(6) Add 3 to every element of the second row of a
(7) Assign the vector [5; 7; 11; 13; 17] to the variable x. Assign the vector
[1; 2; 3; 5; 7] to the variable y.
(8) Find the sum of the component-wise multiplication of x and y
(9) Raise each element of x to the power of the corresponding element in y
(10) Divide each element of x by the corresponding element in y
(11) Create a vector with the elements
----------
Write Matlab code that does the following:
(1) Create a vector of the numbers 1 to 100
(2) Create a vector of the even numbers between 1 and 49 in reverse order (that
is [48, 46, . . . , 2])
(3) Assign the matrix
| 1 2 3 |
| 4 5 6 |
| 3 2 1 |
to a variable a
(4) Add the rst column of a to the second column of a
(5) Add 3 to every element of a
(6) Add 3 to every element of the second row of a
(7) Assign the vector [5; 7; 11; 13; 17] to the variable x. Assign the vector
[1; 2; 3; 5; 7] to the variable y.
(8) Find the sum of the component-wise multiplication of x and y
(9) Raise each element of x to the power of the corresponding element in y
(10) Divide each element of x by the corresponding element in y
(11) Create a vector with the elements
- [1; 1=2; 1=3; : : : ; 1=100]
- [0; 1=2; 2=3; 3=4; : : : ; 99=100]
----------
%1 [1:100] %2 [48:-2:1] %3 a = [1 2 3; 4 5 6; 3 2 1] %4 a(:,1) + a(:,2) %5 a + 3 %6 a(2,:) = a(2,:) + 3 %7 x = [5 7 11 13 17] y = [1 2 3 5 7] %8 sum(x .* y) %9 x .^ y %10 x ./ y %11 vector1 = 1 ./ [1:100]; vector2 = [0:99] ./ [1:100]; rats( vector1(1:3) ) rats( vector2(1:4) )
Refer to Exercise 8.5. Compute 10-year relative population change
8.7. Refer to Exercise 8.5. Compute 10-year relative population change y1 = (5.3 − 3.9)/3.9,
y2 = (7.2 − 5.3)/5.3, etc.
(a) Compute sample mean, median, and variance of the relative population change.
(b) Construct a time plot of the relative population change. What trend do you see now?
(c) Comparing the time plots in Exercises 8.6 and 8.7, what kind of correlation between
xi and yi would you expect? Verify by computing the sample correlation coefficient
What can you conclude? How would you explain this phenomenon?
y2 = (7.2 − 5.3)/5.3, etc.
(a) Compute sample mean, median, and variance of the relative population change.
(b) Construct a time plot of the relative population change. What trend do you see now?
(c) Comparing the time plots in Exercises 8.6 and 8.7, what kind of correlation between
xi and yi would you expect? Verify by computing the sample correlation coefficient
What can you conclude? How would you explain this phenomenon?
a)
Relative Population Mean
= 0.2238
Relative population
Median = 0.2097
Relative population
variance = 0.0103
b)
This plot basically show the
relative rate of change in the population after each decade. It seems like the
growth of the population is decreasing after each decade. This is not plotting
the total number of the population, instead this plotting the relative rate of
“increase of population”
c) While comparing the time plots
in Exercises 8.6 and 8.7, I am expecting a negative correlation between xi and yi .
Because if you look at the plot of 8.6, the value are increasing but the plot
in example 8.7 show the value is decreasing.
Subscribe to:
Posts (Atom)























