Question
(a) What is the value of y if y=length(linspace(0.1,0.5))? Give a short explanation how you get your answer. (b) Assume matrix B exists in the
(a) What is the value of y if y=length(linspace(0.1,0.5))? Give a short explanation how you get your answer.
(b) Assume matrix B exists in the workspace containing a number of rows and columns.
i. Write a single MATLAB statement to assign the elements of the last column to variable lastColumn.
ii. Using your answer in part(i) above, write a single MATLAB statement to assign the number of elements in a variable lastColumn to a variable called numElems.
iii. Write a series of MATLAB statements to determine the average of all elements in matrix B which are multiples of 6 (without using loop structures) and assign the answer
to variable avgdiv6.
(c) Write a series of MATLAB statements to determine and display (using fprintf function) how many odd numbers exists in matrix B. Format of display should be:
There are ..odd numbers in matrix B.
(d) Write a series of MATLAB statements to display the elements of column 2 in matrix B in descending order
(e) Write a series of MATLAB statements to calculate how many numbers in matrix B which are between 12 and 65 (all inclusive) and assign the answer to variable numInRange.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started