
To create:
The length of the string and also its first and last characters.

Answer to Problem 7.1P
Solution:
The script is saved and executed as follows.
Explanation of Solution
Consider the string is Akhil.
The length of the string is 5.
The first character of the string is A.
The last character of the string is l.
MATLAB Code:
string = input('Enter a string: ','s');
% Define the instruction to enter a string.
fprintf('The number of character used in a string: %d\n', length(string))
% Define the length of the string.
fprintf('The first character used in the input string is: %s\n', string(1))
% Define the instruction to print the first character of the input string.
fprintf('The last character used in the input string is: %s\n', string(end))
% Define the instruction to print the last character of the input string.
Save the MATLAB script with name, chapter_7_45251_7_1P.m in the current folder. Execute the program by typing the string name at the command window to create the length of the character
Result:
Therefore, the script is saved and executed.
Want to see more full solutions like this?
Chapter 7 Solutions
Matlab, Fourth Edition: A Practical Introduction to Programming and Problem Solving
- What is the explanation of the solution and answer to the problem: Boxes of floor tiles are to be offered for sale at a special price of $75. The boxes claim to contain at least 100 tiles each. b. How may the seller benefit if the numbers 12,16,7,8,21,4,11,6,5 and 10 are used to draw the stem-and-leaf diagram instead of the actual numbers of tiles? Answer: Seller may notice that 10+16+7+8+21+4+11+6+5+10=100,which means that 11 (rather than ten) boxes of 100 tiles could be offered for sale.arrow_forwardTable Summary: A table with 5 rows and 5 columns. The columns are titled y and the column heads are 0, 1, 2, 3, and 4. The rows are titled X and the row heads are 0, 1, 2, 3, and 4. X 0 y 1 2 3 4 0 0.03 0.01 1 0.09 0.01 0.05 0.08 0.03 0.01 0.02 0.01 2 0.09 3 0.04 0.05 0.07 0.04 0.02 0.06 0.04 0.07 0.04 0.02 0.03 0.04 0.03 0.02 Refer to Exercise 9. a. Find μx+Y. b. Find σx+Y. c. Find P(X + Y = 5).arrow_forwardAssume that the cost of an engine repair is $50, and the cost of a transmission repair is $100. Let T represent the total cost of repairs during a one-hour time interval. y X 0 1 2 3 0 0.13 0.10 0.07 0.03 1 0.12 0.16 0.08 0.04 2 0.02 0.06 0.08 0.04 3 0.01 0.02 0.02 0.02 Find uT. Find σT. Find P (T=250).arrow_forward
- For continuous random variables X and Y with joint probability density function a. Find P(X > 1 and Y > 1). xe-(x+2y) f(x, y) = x > 0 and y > 0 0 otherwise b. Find the marginal probability density functions fx(x) and fy(y). c. Are X and Y independent? Explain.arrow_forwardWhat is the detailed solution and explanation on how to get the answer in questions 11b and 11c?arrow_forwardHow did we come up with the graph in the solution? What are the ordered pairs in both solid line and broken line graphs and how did we get those points?arrow_forward
- The data below shows the number of jobs that a sample of people had in their lifetime: 6 10 10 10 10 11 11 11 12 12 13 13 13 15 15 Provide the five-number summary: (Round the answers to 2 decimal places) Min 6.00 Create the boxplot: 6 7 8 9 6 7 8 7 8 00 Q1 10.00 10 Median 11.00 11 12 13 14 The number of jobs 9 10 11 12 The number of jobs 13 14 15 9 10 11 12 13 14 15 The number of jobs 6 7 8 9 10 11 12 The number of jobs 13 14 15 Q3 Max 13.00 15.00arrow_forwardA random sample of high schooler's hourly rates (in dollars) at part time jobs are recorded in the table below. Salary 11.45 11.10 11.20 12.30 12.60 14.50 17.90 12.10 12.30 50.15 a. For the data shown above, find the following. Round the answer in the first blank to 2 decimal places. Put the correct units in the second blank. Find the mean: 16 Find the median: Find the mode: b. Remove the high math tutor salary of 50.15 dollars from the data. Recompute the following. Round the answer in the first blank to 2 decimal places. Put the correct units in the second blank. Find the mean: Find the median: Find the mode: c. Which of the following statistics was most affected by removing the high math tutor salary from the data? O mode mean O medianarrow_forwardCalculate the 22th percentile of the data shown 16.3 18.7 33.2 35.5 46.7 47.2 49.3 58.3 61.3 61.8arrow_forward
- Please use R to answer the following question: The built in dataset faithful records the time between eruptions and the length of the prior eruption (both in minutes) for 272 inter-eruption intervals (load the data with data(faithful)).arrow_forwardplease do not answer !The scores on a college entrance exam are approximately normally distributed with a mean of 500 and a standard deviation of 100. What percentage of students score above 650? What percentage score between 400 and 600? What score marks the top 10% cutoff (i.e., the 90th percentile)? If a random sample of 25 students is taken, what is the probability their average score exceeds 520?arrow_forwardIs the graph of percentage cumulative frequency polygon in question 9a correct and what are the ordered pairs in creating the graph?arrow_forward
- Algebra: Structure And Method, Book 1AlgebraISBN:9780395977224Author:Richard G. Brown, Mary P. Dolciani, Robert H. Sorgenfrey, William L. ColePublisher:McDougal LittellAlgebra & Trigonometry with Analytic GeometryAlgebraISBN:9781133382119Author:SwokowskiPublisher:CengageCollege Algebra (MindTap Course List)AlgebraISBN:9781305652231Author:R. David Gustafson, Jeff HughesPublisher:Cengage Learning
- Mathematics For Machine TechnologyAdvanced MathISBN:9781337798310Author:Peterson, John.Publisher:Cengage Learning,Holt Mcdougal Larson Pre-algebra: Student Edition...AlgebraISBN:9780547587776Author:HOLT MCDOUGALPublisher:HOLT MCDOUGAL



