Create a standard normal distribution object with the mean equal to 0 and the standard deviation equal to 1.
Example: creating a handle to an anonymous function with one vector-valued input variable bowlVec = @(x)x(1)^2+(x(2)-2)^2; Example: creating a handle to a named function with two scalar-valued input variables bowlVecNamed = @(x)bowlNamed(x(1),x(2)); ezsurf cannot accept handles with vector-valued arguments (stick with examples on previous pages).
These functions are called built-ins. Many standard mathematical functions, such as sin(x), cos(x), tan(x), ex, ln(x), are evaluated by the functions sin, cos, tan, exp, and log respectively in MATLAB. Table 2.1 lists some commonly used functions, where variables x and y can be numbers, vectors, or matrices. The simplest way to create a matrix in MATLAB is to use the matrix constructor operator,. Create a row in the matrix by entering elements (shown as E below) within the brackets. Separate each element with a comma or space: row = E1, E2., Em row = E1 E2.
Define the input vector x to contain the values at which to calculate the pdf.
Compute the pdf values for the standard normal distribution at the values in x.
Each value in y corresponds to a value in the input vector x. For example, at the value x equal to 1, the corresponding pdf value y is equal to 0.2420.
Alternatively, you can compute the same pdf values without creating a probability distribution object. Use the
pdf
function, and specify a standard normal distribution using the same parameter values for and .The pdf values are the same as those computed using the probability distribution object.
Create a Poisson distribution object with the rate parameter, , equal to 2.
Define the input vector x to contain the values at which to calculate the pdf.
![Matlab Matlab](/uploads/1/2/4/9/124914976/998707977.png)
Compute the pdf values for the Poisson distribution at the values in x.
Basic Matlab Programming Examples Pdf
Each value in y corresponds to a value in the input vector x. For example, at the value x equal to 3, the corresponding pdf value in y is equal to 0.1804.
Alternatively, you can compute the same pdf values without creating a probability distribution object. Use the
pdf
function, and specify a Poisson distribution using the same value for the rate parameter, .The pdf values are the same as those computed using the probability distribution object.
Matlab Optimization Toolbox Examples Pdf
Create a standard normal distribution object.
Specify the
x
values and compute the pdf. Plot the pdf.
Create a Weibull probability distribution object.
Specify the
x
values and compute the pdf. Plot the pdf.