Matlab assignment

posted in: Research Paper | 0

Problem 57.8.3

Write a function that outputs the result of rolling N six sided dice. The function should have with one output, the total, and one input, N the number of dice. The write a live script that rolls three dice 100 times and calculates the mean and standard deviation of those rolls.

Problem 58.1.1

Make a semilogy plot of the first 100 Fibonacci numbers and second plot of the ratio of adjacent Fibonacci numbers. Have each point be a circle and connect the circles with a line.

Problem 58.1.2

part 1)

In one figure window and without using subplot plot

y = mx + b

with m = 2, and b = −1, 0, 1 from x = 0.01 → 100 using:

  1. a) plot(x,y);grid
  2. b) semilogx(x,y);grid
  3. c) semilogy(x,y);grid
  4. d) loglog(x,y);grid

So four plots, each with three curves. Comment on the results.

part 2) What functions produce straight lines when plotted using semilogx and semilogy. Show example plots.

Problem 58.2.1

Using a live script make a line plot of sinc function

y(x) = sinc(πx) = sin (πx) / πx from

x = −10 to 10. Use eps to address the singularity that occurs at x = 0. Use handle graphs make the figure fill a 5 inch wide by two inch tall. The curve should be a thick purple line. Make the y-axis label have the expression for the function displaced as an equation with the Greek letter for π.

Problem 58.2.2 Make four plots in one figure window using the position attribute rather then using subplot. The first two plots are a semilogy plot of the first 100 Fibonacci numbers, linear plot of the ratio of adjacent Fibonacci numbers.

The second two plots are the first 10,000 prime numbers and the ratio of adjacent minus 1. For this last plot use dots and don’t connect the dots with a line.

Experiment with, semilogx, semilogy, and loglog to find the one that best shows the results, i.e. the approach that doesn’t smush the data up against axes. Arrange the plot in in two rows and two columns and be sure the plots are easy to read and convey as much information as possible.

Equation 18.86 gives the transfer function for the motion that results from a force applied to a mass spring damper system. Make a plotyy plot of the magnitude and phase.

 

Last Updated on