Question: Exercises (to be completed using Matlab) Assign the value 20 to a variable called height . Assign the value 30 to a variable called width

Exercises (to be completed using Matlab)

  1. Assign the value 20 to a variable called height. Assign the value 30 to a variable called width.
  2. Swap the values of height and width without using any literals.
  3. The surface area and volume of a sphere are 4r2 and (4/3)r3, respectively. Find the surface area and volume of a sphere with radius of 5 cm by assigning the value to the variable radius and using it to calculate the values of variables surfaceArea and volume.
  4. Save your variables to a matlab binary file, clear the matlab workspace of all variables, and retrieve the variables back again from the saved file. Check that the variables exists using the whos command and by looking at the Workspace window
  5. Assign a vector containing the values -1/3, 0, 1/3, 2/3. Use it to display the result in short and long format, in short scientific notation, and in fractional form.
  6. Assign a string variable (greater than 3 characters long) and display its third character.
  7. Assign an evenly spaced vector of values from 0 to 20 in increments of 2, using code that automatically generates the values (i.e. dont type in every value).
  8. Assign a column vector called myVec containing 15 values, evenly spaced between 4 and 20 using the linspace function.
  9. Assign an array variable with 11 rows and 2 columns, where column 1 contains evenly spaced values from 0 to 100, the second column contains evenly spaced values from 92.2 to 103.5. Use a single automatic generation command line to accomplish this.
  10. Display the value of the 8th element in the second column of your array variable. Now calculate the value of that element divided by the 2nd element in the second column using variables and indexing (not the numbers themselves).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!