Essay about 6 Plotting And Anonymous Functions

Submitted By thesbskate
Words: 1007
Pages: 5

Plotting and Anonymous Functions
Designed to test skills: array creation and arithmetic, substitution, plotting (fplot, polar, semilogy, bar, stair, stem, etc.), sub-plotting, distinguishing plotted data (legend, linestyle, etc.), plotting multiple arrays as one series, reading comprehension, and anonymous functions
1. Create the vector x=[0:0.01:10]. Then use the vector to calculate the following: First derivative of A(x) Second derivative of A(x)
Now create one graph containing plots of all three functions. For all assignments, always follow good graphing practices, for example:
a. Distingquish each series clearly (i.e., with different colors and line types and don’t forget to include a legend). Note: when grading we assume your assignments are printed in black and white.
b. Title your plot. Note: your title should be more informative than simply restating the axes labels.
c. Label all axes with a name and units. (When there are no units, indicate ‘unitless’)

2. Clearly plot the function for .
Notice that the function has a vertical asymptote at x=2. Avoid plotting the asymptote itself: Create two vectors for the domain of x (x1 for before the asymptote and x2 for after). Calculate the corresponding y arrays. Now appropriately plot all 4 arrays in the same plot: y1 vs x1 and y2 vs x2. (Note: the plotted series should be the same color to communicate that one function is plotted. This can be accomplished with the hold command. If both series were instead plotted with one call to the plot function, the 2 series will appear with different colors by default—which would be incorrect.)

3. You are given the following experimental data that a pressure gauge collected during a diving excersise.
Depth (meters)
0
10
20
30
40
50
60
70
80
Pressure (kPa)
100.7
202.2
300.1
402.8
504.8
604.4
704.4
803.7
904.2

a. Create one plot that shows the plot of the experimental data. Notes: (1) Depth, being parallel with “up and down” is conventionally plotted on the y-axis. (2) Any positive depth is conventionally plotted below the x-axis (negative) (3) Specify a visible linestyle that does not imply that there is more experimental data than these 9 data points.
b. Use the depth pressure equation —where: r is water density, g is gravity, h is the depth below the surface (in meters), Patm is atmospheric pressure, and P is in kPa—to make a plot of the theoretical pressures. Plot pressure for depths between 0 and 80 meters with g = 9.81 m/s2, r = 1030 kg/m3, and Patm is 101.325 kPa. Note: experimental data is conventially plotted in the same graph as the associated theoretical relationship.

4. In an electric circuit comprised of a load resistance “RL” and a voltage source “vs”, the circuit induces the voltage source with an internal resistance “rs”. The power dissipated in the load is then given by:

Plot the power P as a function of RL for given that vs = 12 V and rs = 2.5 Ω Notes: (1) Greek letters can be placed in the text fields of figures using a backslash (e.g. \alpha or \Alpha), try: \Omega in your labeling. (2) do not forget the units for power
5. The position x(t) as a function of time of a particle that moves along a straight line is given by:

The velocity v(t) of this particle is the derivative of the postion function:

Likewise, the acceleration a(t) of the particle is given by the derivative of the velcoity:

Create one figure that contains all three of these functions vs t where . To plot these functions, use the fplot command. Using the subplot command arrange the graphs into one column with 3 rows (Don’t forget to include a title and axis labels.) Time is in seconds; position is in meters; velocity is in m/s; and acceleration is in m/s2.

6. Using the equation