# Solution Library

# Find Maximum and Minimum values of Given Elements Using MATLAB

**Question**

For the following, write the commands in a script file leaving the semi-colon off so the answers print in the command window. Turn in the script and output. Output should include:

a. number of elements in ts1

b. number of elements in ts2

c. first element in ts1

d. first element in ts2

e. sum of ts1

f. minimum value in ts1

g. mean of ts1

h. first element in tsRev

i. last element in tsRev

** **

Create a script that first creates two variables, **ts1 **and **ts2**. Use **linspace **to create **ts1** and the **: **operator to create **ts2**.

- Both ts1 and ts2 should start at 0 and end at 1, and have (approximately) 100 elements.
- Check that the number of elements is approximately correct using the command
**length**on both variables - Check that the first element of each array is, indeed, zero, by accessing the first element using the ts(1) syntax.
- Check that the last element of each array is, indeed, 1, by accessing the last element of each array
- Hint: What do you put in the () to get the last element?
- Calculate the sum, min and average (mean) of the ts1 array

- What should the min value be?
- What should the mean value be?
- Use
**linspace**to create an array tsRev that has the same values as ts1, but in reverse order. - Check the first and last values of tsRev.

**Summary**

This question belongs to MATLAB software and discusses about application of MATLAB in mathematics to find out the maximum and minimum values in a group of given elements.

Download Full Solution

## Comments

Rashathis is a very good website

maaniI have 50 questions for the same test your page is showing only 28

joeannehi can you please help or guide me to answer my assignments. thanks

joeannehi can anyone help or guide me to my assignments. thanks

MonikCristinaThis solution is perfect ...thanks

JaneteHello Allison,I love the 2nd image that you did! I also, had never heard of SumoPaint, is something that I will have to exolpre a bit! I understand completely the 52 (or so) youtube videos that you probably watched. Sometimes they have what you want, sometimes they don't! However, it is always satisfying when you are able to produce something that you have taught yourself. Great job!Debra 0 likes

SandeepPerfect bank of solution.

Oxanagreat !

Paul Brandon-Fritziusthanks for the quick response. the solution looks good. :)

tina Johnsonthnx for the answer. it was perfect. just the way i wanted it.

Giuseppeworks fine.