EGR 103/Fall 2019/Minilab 4

From PrattWiki
Revision as of 04:34, 3 December 2019 by DukeEgr93 (talk | contribs) (Created page with "== Troubleshooting == * If MATLAB tells you it can't find the file and brings up a dialogue box including the ability to change the folder, click the button to change the fold...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Troubleshooting

  • If MATLAB tells you it can't find the file and brings up a dialogue box including the ability to change the folder, click the button to change the folder.

Typos

  • None yet!

4.5.1 - Chapra 8.2

Partial Answer

(1)
     5     8    15
     8     4    10
     6     0    10
(3)
     3    -2    -1
    -6     0     4
    -2     0    -2
(4)
    28    21    49
     7    14    49
    14     0    28
(5)
     3     6     1
(6)
    25    13    74
    36    25    75
    28    12    52
(7)
    54    76
    41    53
    28    38
(8)
     9     2
     4    -1
     3     7
    -6     5
(11)
    66    19    53
    19    29    46
    53    46   109
(12)
    46

4.5.2 - Chapra 2.16

  • To get multiple lines on the same graph, you will plot the first one then issue the command hold on. Make the rest of your plots, then set hold off. For example:
plot(x, y1, 'k-')
hold on
plot(x, y2, 'r--')
plot(x, y3, 'g:')
hold off
  • For the legend, add labels to the legend command in the order you made the plots. For example:
legend('y1', 'y2', 'y3', 'location', 'best')
The last part tells MATLAB to put the legend in the best - or most clear - location.

Partial Answer

St: 5.793e+00
Sr: 7.850e-02
r2: 9.864e-01

The model should be a green dashed line going through the data points.

4.5.3 - Chapra 3.10

  • Be sure to create an anonymous function called u_y that returns a value. Since the return calculation is long, you will want to put it in multiple lines separated by ellipses (...). For instance, the following calculation is one line of code:
u_y = @(x) x.^3 + x.^2 + ...
    x.^1 + x.^0

Partial Answer

Root 1: 2.338e+00
Root 2: 7.762e+00
Min of y=-2.086e+01 at x=+1.279e+00
Min of y=-3.274e+01 at x=+8.708e+00
Min of y=-2.086e+01 at x=+1.279e+00
Max of y=+1.953e+02 at x=+5.702e+00

The graph should be like your graph from a previous lab for this problem.

4.5.4 - Chapra 3.26

  • This one takes a while to process; it is not the most efficient way of making this graph since it calls the plot command 10k times; far better to calculate the values and then use a scatter plot (not required)

Partial Answer

4.5.5 - Chapra 8.3 and 5

  • For complex numbers, write the imaginary part followed directly by a j with no space -- including if you are writing just j. Also, do not put spaces around the + or - between the real and imaginary parts - for instance:
a = 4+1j
Do not use i (it works, but still...) and do not forget to put the number in front of j, even if that number is a 1.

Partial Answer

8.3: 
  -1.5181e+01
  -7.2464e+00
  -1.4493e-01
8.5:
  -5.3333e-01 + 1.4000e+00i
   1.6000e+00 - 5.3333e-01i

4.5.6 - Chapra 3.9

  • Don't forget to use .* ./ and .^ when needed

Partial Answer

  • Lab 8

4.5.7 - Sphere!

  • Don't forget to use .* ./ and .^ when needed

Partial Answer

  • Title of problem.