A MATLAB script works with a matrix A that has 5 rows and 8 columns. One line reads the element A(23).
Which subscript form refers to the same element?
A(3,4)
A(5,3)
A(3,5)
A(3,7)
Unlock full course notes by signing up
Linear index of a matrix element
A matrix A in MATLAB has 7 rows and 8 columns. Find the linear index k for which A(k) refers to the same element as A(4,6).
Give k as a whole number. It is a dimensionless position count, so no units are needed.
Choose shapes for laboratory data
An engineer specifies four separate numeric arrays for a laboratory program:
Calibration stores one pressure value of 101.3 kPa101.3\ \text{kPa}101.3 kPa.
Temperatures stores six temperature readings in one row.
Count readings in an expanded recording
A laboratory stores one numeric reading from every probe at every sampling instant. Rows represent probes, and columns represent sampling instants. An initial recording contains 565656 scalar readings collected over eight instants, with no missing entries.
The laboratory repeats the experiment using three additional probes and five additional sampling instants compared with the initial recording. Every probe is recorded at every instant in the repeat experiment.
Determine the original number of probes and the total number of scalar readings in the repeat experiment. Enter both counts as exact integers.
Reading a matrix in storage order
In MATLAB,
a) State size(B), numel(B) and length(B).
b) Write out the column vector produced by B(:) and give its size.