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.
- 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.
- From the
command line, evaluate these expressions (a-d) using the following
values, .
3.
A hollow sphere has an external diameter of 6.3125 and
internal diameter of 5.762. Determine the volume (V) where :
- 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. - 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. - Plot
**X**vs.**X**(**N.B.**Anytime I say to "plot" something I'm expecting you to print out a copy of your results.) - 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. - Create a
vector
**W**with a starting value of and an ending value of with increments of 0.00021 between values. - Evaluate the
function where
"ABS" is the absolute value of the function in parenthesis.
- Evaluate the
function
- Evaluate the
function
- Plot Y vs. Z.
Print this result.
- 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. - Now for both the horizontal and
vertical axes, set the axis limits to be 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. - 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. - 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. |