
Concept explainers
To find:
The output of the following sequence of statements and expressions, and verify them.
pvec = 3:2:10
pvec(2) = 15
pvec(7) = 33
pvec([2:4 7])
linspace(5, 11, 3)
logspace(2, 4, 3)

Answer to Problem 2.1P
Solution:
The output of the following sequence of statements and expressions:
“pvec = 3:2:10”, “pvec(2) = 15” “pvec(7) = 33”, “pvec([2:4 7])”, “linspace(5, 11, 3)”, and “logspace(2, 4, 3)” are “pvec = 3 5 7 9”, “pvec = 3 15 7 9 0 0 33”, “ans = 15 7 9 33”, “ans = 5 8 11”, and “ans = 100 1000 10000” respectively.
Explanation of Solution
Consider the following statement,
pvec = 3:2:10
The statement will generate the sequence of number from 3 to 10 in increment of 2.
So, the output is “pvec = 3 5 7 9”.
Consider the following statement,
pvec(2) = 15
The expression replaces the second term of the sequence of “pvec” with “15” and then displays sequence.
So, the output is “pvec = 3 15 7 9”.
Consider the following statement,
pvec(7) = 33
The expression replaces the seventh term of the sequence of “pvec” with “33” and then displays sequence. Since, the values of the 5th and the 6th terms are not allotted, so these terms are allotted with zero.
So, the output is “pvec = 3 15 7 9 0 0 33”.
Consider the following statement,
pvec([2:4 7])
The expression displays the values placed 2nd to 4th and then 7th from the sequence.
So, the output is “ans = 15 7 9 33”.
Consider the following statement,
linspace(5, 11, 3)
The expression generates three values that are equally spaced from 5 to 11.
So, the output is “ans = 5 8 11”.
And, consider the following statement,
logspace(2, 4, 3)
The expression generates three values that are equal to
So, the output is “ans = 100 1000 10000”.
The
MATLAB Code:
clc
clear all
close all
pvec = 3:2:10
% Define the instruction to generate the sequence of number from 3 to 10 in increment of 2.
pvec(2) = 15
% Define the instruction in which the expression replaces the second term of the sequence of “pvec” with “15” and then displays sequence.
pvec(7) = 33
% Define the instruction in which the expression replaces the seventh term of the sequence of “pvec” with “33” and then displays sequence. Since, the values of the 5th and the 6th terms are not allotted, so these terms are allotted with zero.
pvec([2:4 7])
% Define the instruction in which the expression displays the values placed 2nd to 4th and then 7th from the sequence.
linspace(5, 11, 3)
% Define the instruction in which the expression generates three values that are equally spaced from 5 to 11.
logspace(2, 4, 3)
% Define the instruction in which the expression generates three values that are equal to 10^n, here n = 2, 3, 4.
Save the MATLAB script with name, chapter2_54793_2_1P.m in the current folder. Execute the script by typing the script name at the command window to find the answer of the given following sequence of statements and expressions.
Result:
Therefore, the output of the following sequence of statements and expressions:
“pvec = 3:2:10”, “pvec(2) = 15” “pvec(7) = 33”, “pvec([2:4 7])”, “linspace(5, 11, 3)”, and “logspace(2, 4, 3)” are “pvec = 3 5 7 9”, “pvec = 3 15 7 9 0 0 33”, “ans = 15 7 9 33”, “ans = 5 8 11”, and “ans = 100 1000 10000” respectively.
Want to see more full solutions like this?
Chapter 2 Solutions
MATLAB: A Practical Introduction to Programming and Problem Solving
- Microsoft Excel snapshot for random sampling: Also note the formula used for the last column 02 x✓ fx =INDEX(5852:58551, RANK(C2, $C$2:$C$51)) A B 1 No. States 2 1 ALABAMA Rand No. 0.925957526 3 2 ALASKA 0.372999976 4 3 ARIZONA 0.941323044 5 4 ARKANSAS 0.071266381 Random Sample CALIFORNIA NORTH CAROLINA ARKANSAS WASHINGTON G7 Microsoft Excel snapshot for systematic sampling: xfx INDEX(SD52:50551, F7) A B E F G 1 No. States Rand No. Random Sample population 50 2 1 ALABAMA 0.5296685 NEW HAMPSHIRE sample 10 3 2 ALASKA 0.4493186 OKLAHOMA k 5 4 3 ARIZONA 0.707914 KANSAS 5 4 ARKANSAS 0.4831379 NORTH DAKOTA 6 5 CALIFORNIA 0.7277162 INDIANA Random Sample Sample Name 7 6 COLORADO 0.5865002 MISSISSIPPI 8 7:ONNECTICU 0.7640596 ILLINOIS 9 8 DELAWARE 0.5783029 MISSOURI 525 10 15 INDIANA MARYLAND COLORADOarrow_forwardSuppose the Internal Revenue Service reported that the mean tax refund for the year 2022 was $3401. Assume the standard deviation is $82.5 and that the amounts refunded follow a normal probability distribution. Solve the following three parts? (For the answer to question 14, 15, and 16, start with making a bell curve. Identify on the bell curve where is mean, X, and area(s) to be determined. 1.What percent of the refunds are more than $3,500? 2. What percent of the refunds are more than $3500 but less than $3579? 3. What percent of the refunds are more than $3325 but less than $3579?arrow_forwardA normal distribution has a mean of 50 and a standard deviation of 4. Solve the following three parts? 1. Compute the probability of a value between 44.0 and 55.0. (The question requires finding probability value between 44 and 55. Solve it in 3 steps. In the first step, use the above formula and x = 44, calculate probability value. In the second step repeat the first step with the only difference that x=55. In the third step, subtract the answer of the first part from the answer of the second part.) 2. Compute the probability of a value greater than 55.0. Use the same formula, x=55 and subtract the answer from 1. 3. Compute the probability of a value between 52.0 and 55.0. (The question requires finding probability value between 52 and 55. Solve it in 3 steps. In the first step, use the above formula and x = 52, calculate probability value. In the second step repeat the first step with the only difference that x=55. In the third step, subtract the answer of the first part from the…arrow_forward
- If a uniform distribution is defined over the interval from 6 to 10, then answer the followings: What is the mean of this uniform distribution? Show that the probability of any value between 6 and 10 is equal to 1.0 Find the probability of a value more than 7. Find the probability of a value between 7 and 9. The closing price of Schnur Sporting Goods Inc. common stock is uniformly distributed between $20 and $30 per share. What is the probability that the stock price will be: More than $27? Less than or equal to $24? The April rainfall in Flagstaff, Arizona, follows a uniform distribution between 0.5 and 3.00 inches. What is the mean amount of rainfall for the month? What is the probability of less than an inch of rain for the month? What is the probability of exactly 1.00 inch of rain? What is the probability of more than 1.50 inches of rain for the month? The best way to solve this problem is begin by a step by step creating a chart. Clearly mark the range, identifying the…arrow_forwardClient 1 Weight before diet (pounds) Weight after diet (pounds) 128 120 2 131 123 3 140 141 4 178 170 5 121 118 6 136 136 7 118 121 8 136 127arrow_forwardClient 1 Weight before diet (pounds) Weight after diet (pounds) 128 120 2 131 123 3 140 141 4 178 170 5 121 118 6 136 136 7 118 121 8 136 127 a) Determine the mean change in patient weight from before to after the diet (after – before). What is the 95% confidence interval of this mean difference?arrow_forward
- In order to find probability, you can use this formula in Microsoft Excel: The best way to understand and solve these problems is by first drawing a bell curve and marking key points such as x, the mean, and the areas of interest. Once marked on the bell curve, figure out what calculations are needed to find the area of interest. =NORM.DIST(x, Mean, Standard Dev., TRUE). When the question mentions “greater than” you may have to subtract your answer from 1. When the question mentions “between (two values)”, you need to do separate calculation for both values and then subtract their results to get the answer. 1. Compute the probability of a value between 44.0 and 55.0. (The question requires finding probability value between 44 and 55. Solve it in 3 steps. In the first step, use the above formula and x = 44, calculate probability value. In the second step repeat the first step with the only difference that x=55. In the third step, subtract the answer of the first part from the…arrow_forwardIf a uniform distribution is defined over the interval from 6 to 10, then answer the followings: What is the mean of this uniform distribution? Show that the probability of any value between 6 and 10 is equal to 1.0 Find the probability of a value more than 7. Find the probability of a value between 7 and 9. The closing price of Schnur Sporting Goods Inc. common stock is uniformly distributed between $20 and $30 per share. What is the probability that the stock price will be: More than $27? Less than or equal to $24? The April rainfall in Flagstaff, Arizona, follows a uniform distribution between 0.5 and 3.00 inches. What is the mean amount of rainfall for the month? What is the probability of less than an inch of rain for the month? What is the probability of exactly 1.00 inch of rain? What is the probability of more than 1.50 inches of rain for the month? The best way to solve this problem is begin by creating a chart. Clearly mark the range, identifying the lower and upper…arrow_forwardProblem 1: The mean hourly pay of an American Airlines flight attendant is normally distributed with a mean of 40 per hour and a standard deviation of 3.00 per hour. What is the probability that the hourly pay of a randomly selected flight attendant is: Between the mean and $45 per hour? More than $45 per hour? Less than $32 per hour? Problem 2: The mean of a normal probability distribution is 400 pounds. The standard deviation is 10 pounds. What is the area between 415 pounds and the mean of 400 pounds? What is the area between the mean and 395 pounds? What is the probability of randomly selecting a value less than 395 pounds? Problem 3: In New York State, the mean salary for high school teachers in 2022 was 81,410 with a standard deviation of 9,500. Only Alaska’s mean salary was higher. Assume New York’s state salaries follow a normal distribution. What percent of New York State high school teachers earn between 70,000 and 75,000? What percent of New York State high school…arrow_forward
- Pls help asaparrow_forwardSolve the following LP problem using the Extreme Point Theorem: Subject to: Maximize Z-6+4y 2+y≤8 2x + y ≤10 2,y20 Solve it using the graphical method. Guidelines for preparation for the teacher's questions: Understand the basics of Linear Programming (LP) 1. Know how to formulate an LP model. 2. Be able to identify decision variables, objective functions, and constraints. Be comfortable with graphical solutions 3. Know how to plot feasible regions and find extreme points. 4. Understand how constraints affect the solution space. Understand the Extreme Point Theorem 5. Know why solutions always occur at extreme points. 6. Be able to explain how optimization changes with different constraints. Think about real-world implications 7. Consider how removing or modifying constraints affects the solution. 8. Be prepared to explain why LP problems are used in business, economics, and operations research.arrow_forwardged the variance for group 1) Different groups of male stalk-eyed flies were raised on different diets: a high nutrient corn diet vs. a low nutrient cotton wool diet. Investigators wanted to see if diet quality influenced eye-stalk length. They obtained the following data: d Diet Sample Mean Eye-stalk Length Variance in Eye-stalk d size, n (mm) Length (mm²) Corn (group 1) 21 2.05 0.0558 Cotton (group 2) 24 1.54 0.0812 =205-1.54-05T a) Construct a 95% confidence interval for the difference in mean eye-stalk length between the two diets (e.g., use group 1 - group 2).arrow_forward
- Algebra & Trigonometry with Analytic GeometryAlgebraISBN:9781133382119Author:SwokowskiPublisher:CengageCollege AlgebraAlgebraISBN:9781305115545Author:James Stewart, Lothar Redlin, Saleem WatsonPublisher:Cengage LearningAlgebra: Structure And Method, Book 1AlgebraISBN:9780395977224Author:Richard G. Brown, Mary P. Dolciani, Robert H. Sorgenfrey, William L. ColePublisher:McDougal Littell

