Each of the problems below is intended to be solved by generating a script or m-file. Be sure to have a very clearly written header for each M-file so that anyone reading your work can decipher the sort of problems you are solving in each M-file. Also, be sure to label all axes and assign each plot a title.

A complete set of m-file solutions can be found here. Of course, your work does not have to look exactly like these scripts but the results (e.g. plots) should look much the same. Don’t be lazy and start by looking at these answers … only refer to these solutions if you get stuck or want to check your finished work.

Problems #1-3 do not have to be turned in as they are designed to get you going with Matlab. However, these problems are part of later homework questions (see below).

  1. Read the HELP pages on the following functions (either by typing "help" and then the function name at the MATLAB command prompt, or by clicking these links): help, helpwin, more, who, lookfor, what, dir, path, addpath, pwd, cd, clear, clc, type, echo, script, plot, grid, clf, title, xlabel, ylabel, axis, hold, abs, sqrt, pi, sin, cos, exp, keyboard, figure.
  2. From the command line, evaluate these expressions (a-d) using the following values, core_1vals.gif (293 bytes).
    1. core_11.jpg (3808 bytes)
    2. core_12.jpg (1838 bytes)
    3. core_13.jpg (6357 bytes)
    4. core_14.jpg (3488 bytes)

3.    A hollow sphere has an external diameter of 6.3125 and internal diameter of 5.762. Determine the volume (V) where :

                                     
core_15.gif (283 bytes)

Where, RE and RI are the external and internal radii, respectively.

Problem #4 should be turned in as a single M-file, that is all the commands should be in a single text file that Matlab can run. As with all M-files, be sure to include a header that gives the user some information about what the file contains and what it does. Click here if you need to review what scripts/M-files are, and how to create and use them.

  1. Create a single M-file that evaluates the expressions for M, N, O and P above.
    Click here to view a sample solution to this problem which should serve as a model for all M-files you submit.


    Problems #5-7 should be turned in as a single M-file, that is all the commands should be in a single text file that Matlab can run. You will also turn in 5 separate plots, one for each variable, i.e. X vs. X, M vs. X, N vs. X, O vs. X and P vs. X. For each of your plots be sure to apply a grid and give your plots X and Y labels as well as titles. Click here if you need to review how to make basic plots in MATLAB. Click here to see what your resulting plots should look like.
  2. Create a vector X with a starting value of 0.0 and an ending value of 50, with increments of 0.1 between values. Click here if you need to review how to create vectors of regularly spaced values.
  3. Plot X vs. X (N.B. Anytime I say to "plot" something I'm expecting you to print out a copy of your results.)
  4. Using the functions created above in Problem #4 (M,N,O,P), plot each as a function of X. That is, reevaluate each function using the vector X as opposed to the scalar x. You're going to have to change things just a little bit because now you're using an array. Take care to use the "." before each of the math operators so that Matlab will know you want to do an element-by-element math operation. Click here if you need to review what element-by-element math operations are, and how and when to use them.


    Problems #8-14 should be turned in as a single M-file, with 3 separate plots as indicated below. Click here to see what your resulting plots should look like.
  5. Create a vector W with a starting value of neg_pi.jpg (893 bytes)and an ending value of pi.gif (53 bytes)with increments of 0.00021 between values.
  6. Evaluate the function core_16.gif (324 bytes)where "ABS" is the absolute value of the function in parenthesis.
  7. Evaluate the function core_17.gif (277 bytes)
  8. Evaluate the function core_18.gif (272 bytes)
  9. Plot Y vs. Z. Print this result.
  10. Now you will plot AY vs. BZ four times but all on the same graph. This means you are going to have to use the "hold" command. For the first plot A = 1 and B = 1. For the second plot A = -1 and B = 1. For the third plot A = -1 and B = -1. And for the fourth plot (again, all on the same graph) A = 1 and B = -1. Print this result. Click here if you need to review how to place multiple plots on the same graph.
  11. Now for both the horizontal and vertical axes, set the axis limits to be pom.gif (53 bytes)1.5 and Print this result.

    Problems #15-16 should be turned in as a single M-file along with the indicated plot for this problem. Click here to see what your resulting plot should look like.
  12. Create a vector RE with a starting value of 5.76 and an ending value of 10.0 with increments of 0.01 between values.
  13. Reevaluate problem #3 but now plot the volume (V) of the sphere as a function of the external diameter (RE). Print this result.

    N.B. It is your responsibility to appropriately label your graphs ... at a minimum this means a title, axes labels and line and/or symbol labels.

To continue on to the next core lesson, click here.