
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
- Question 3 14 pts Refer to output from Question 1 to answer the following. a) (9 points) Use the output information to conduct a statistical test of the research hypothesis that for this diet preparation and length of study, there is a direct (positive) linear relationship between weight gain and amount of lysine eaten. Use a 5% level of significance. b) (5 points) Calculate a 95% confidence interval for the slope and provide an interpretation of this interval.arrow_forwardSuppose we are interested in purchasing a multi-functioning inkjet printer. We want to see how the performance factors related to the price of the printer. Collected data from 20 printers include below information. PPM: Printing rate (pages per minutes) for a set of print jobs Price: Typical retail price (in dollars) at the time of the review. Data is not provided to you, but the default MINITAB output is provided to you. As you can see it is a partial output where you have to do some calculations using the provided information. Use the provided output to answer below questions. Regression Analysis: Price versus PPM Analysis of Variance DF Adj SS Adj MS F-Value P-Value Source Regression 1 PPM 1 74540 74540 74540 74540 21.75 0.000 21.75 0.000 Error 18 Lack-of-Fit 11 44191 Pure Error 7 17506 61697 3428 4017 2501 161 0.271 Total 19 136237 Model Summary S 58.5457 R-sq R-sq(adj) R-sq(pred) 54.71% 52.20% 42.25% Coefficients Term Coef SE Coef T-Value Constant PPM -94.2 90.9 56.4 -1.67 P-Value…arrow_forwardPlease Answer Question 3arrow_forward
- Please answer Question 5arrow_forwardPlease answer Question 2arrow_forwardA researcher is interested in studying how age (in years) associates with resting heart rate (beats per minutes) of adult men. He recruited 35 adult men and recorded their age and measured the resting heart rate (RHR). The researcher is specially interested in understanding whether the resting heart rate of older men is higher. Below MINITAB outputs are provided to you. Output 1 Output 2 Regression Equation RHR 67.89 +0.1576 Age Coefficients Regression Equation Age -78.8 +1.480 RHR Term Coef SE Coef T-Value P-Value VIF Coefficients Constant 67.89 1.42 47.90 0.000 Age 0.1576 0.0497 3.17 0.003 1.00 Term Constant -78.8 RHR 1.480 Coef SE Coef T-Value P-Value VIF 33.8 -2.33 0.467 3.17 0.026 0.003 1.00 Model Summary S R-sq R-sq(adj) R-sq(pred) 0.811306 23.33% 21.01% 13.11% Analysis of Variance Source DF Adj SS Adj MS F-Value P-Value Model Summary S R-sq R-sq(adj) R-sq(pred) 2.48678 23.33% 21.01% Analysis of Variance 10.93% Regression 1 6.609 6.6094 10.04 0.003 Source DF Adj SS Adj MS F-Value…arrow_forward
- Suppose we are interested in purchasing a multi-functioning inkjet printer. We want to see how the performance factors related to the price of the printer. Collected data from 20 printers include below information. PPM: Printing rate (pages per minutes) for a set of print jobs Price: Typical retail price (in dollars) at the time of the review. Data is not provided to you, but the default MINITAB output is provided to you. As you can see it is a partial output where you have to do some calculations using the provided information. Use the provided output to answer below questions. Regression Analysis: Price versus PPM Analysis of Variance DF Adj SS Adj MS F-Value P-Value Source Regression 1 PPM 1 74540 74540 74540 74540 21.75 0.000 21.75 0.000 Error 18 Lack-of-Fit 11 44191 Pure Error 7 17506 61697 3428 4017 2501 161 0.271 Total 19 136237 Model Summary S 58.5457 R-sq R-sq(adj) R-sq(pred) 54.71% 52.20% 42.25% Coefficients Term Coef SE Coef T-Value Constant PPM -94.2 90.9 56.4 -1.67 P-Value…arrow_forwardPlease answer Question 4arrow_forwardA researcher conducts an experiment to examine the relationship between the weight gain of chickens whose diets had been supplemented by different amounts of amino acid lysine and the amount of lysine ingested. Since the percentage of lysine is known, and we can monitor the amount of feed consumed, we can determine the amount of lysine eaten. A random sample of twelve 2-week-old chickens was selected for the study. Each was caged separately and was allowed to eat at will from feed composed of a base supplemented with lysine. The ample data summarizing weight gains and amounts of lysine eaten over the test period are given below. (In the data ✓, y represents weight gain in grams, and x represents the amount of lysine ingested in grams.) Chick y X 1 14.7 0.09 2 17.8 0.14 3 19.6 0.18 4 18.4 0.15 5 20.5 0.16 6 21.1 0.23 7 17.2 0.11 8 18.7 0.19 9 20.2 0.23 10 16.0 0.13 11 17.8 0.17 12 19.4 0.21 1. (3 points) Create a scatterplot of the data using Minitab and paste it below. Does a linear…arrow_forward
- Children develop different patterns of attachment based on interactions with their caregivers at young age (Wikipedia). Certain study attempt to find the association between Child Care and Attachment Pattern Classification. Below table summarizes the collected data. Hours in Child Care Low Moderate High Attachment Pattern (0-3 hours) (4-19 hours) (20-54 hours) Secure 24 35 5 Anxious 11 10 8 Carryout an appropriate test to see if there is an association between amount of time spend on Child Care and Attachment Pattern of the children. 6. In order to answer the same research question as in previous parts in this problem, can we do a hypothesis test for comparing two independent proportions while keeping the existing categories as they are? Explain your answer rather than simply saying "yes" or "no".arrow_forwardThis questions has multiple subparts. For your convenience, the description of the problem is provided with each component. Children develop different patterns of attachment based on interactions with their caregivers at young age (Wikipedia). Certain study attempt to find the association between Child Care and Attachment Pattern Classification. Below table summarizes the collected data. Hours in Child Care Low Moderate High Attachment Pattern (0-3 hours) (4-19 hours) (20-54 hours) Secure 24 35 5 Anxious 11 10 8 Carryout an appropriate test to see if there is an association between amount of time spend on Child Care and Attachment Pattern of the children. 1. The null hypothesis is [Select] and the alternative hypothesis is [Select] [Select] 2. The test statistic is 3. Degrees of freedom 4. P-value is [Select] True proportion of children with secure pattern when low number of hours in child care and true proportion of children with anxious pattern when low number of hours in child Hours…arrow_forwardDoes money buy happiness? This is an age-old question. A random sample of 1993 subjects were asked to rate their happiness (Not too happy, Pretty happy, or Very happy) and also report their level of income (Above average, average, below average). The table of the observations is presented below. Income Not too happy Pretty happy Very happy Total Above Average 26 233 164 423 Average 117 473 293 883 Below Average 172 383 132 687 Total 315 1089 589 1993 1. Which variable is the response and which is the explanatory variable? [Select] 2. What are the null and alternative hypotheses for testing if there is a relationship between level of income and happiness? [Select] and H₁ is [Select] Ho is 3. What is the chi-square test statistic? [Select] 4. Which cell contributed the most to the overall chi-square test statistic? [Select] 5. What are the degrees of freedom? [Select] 6. What is the decision about Ho? [Select]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:Cengage
College 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



