Track a displacement vector through edits

A displacement vector stores readings in millimetres. Execute the following MATLAB commands in order:


MATLAB
d = [4.2 7.8 11.4 15.0 18.6];
d([2 4]) = [];
d(end+1) = 22.2;
d(2) = d(end-1) - d(2);


What is the final value of d(2)? Answer in millimetres, to one decimal place.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Modifying Arrays Questions: