WebAssign is not supported for this browser version. Some features or content might not work. System requirements

WebAssign

Welcome, demo@demo

(sign out)

Saturday, March 29, 2025 04:10 EDT

Home My Assignments Grades Communication Calendar My eBooks

Chapman - MATLAB Programming 7/e (Homework)

James Finch

Physics - Labs, section 1, Fall 2019

Instructor: Sarah Anders

Current Score : – / 15

Due : Monday, January 28, 2030 00:00 EST

Last Saved : n/a Saving...  ()

Question
Points
1 2 3 4 5 6 7 8 9
–/1 –/1 –/1 –/1 –/4 –/1 –/1 –/3 –/2
Total
–/15 (0.0%)
  • Instructions

    Experience the cutting-edge of MATLAB® programming with the 7th Edition of MATLAB® Programming for Engineers, 7th edition, by Stephen J. Chapman and published by Cengage Learning. Updated to reflect MATLAB® R2023a and GUI Apps, this edition features an innovative eBook Reader with an integrated educational IDE, offering auto-graded coding assignments that enhance critical thinking and problem-solving skills. With expanded applications, new end-of-chapter exercises, plus updated equivalents Histgram, PolarPlot and Narginchk, this edition ensures students stay up to date. Enhanced discussions on MATLAB® plot types, data structures, and object-oriented programming, along with effective learning aids like "Good Programming" and "Programming Pitfall" boxes, guide students towards mastering clean, efficient programming. The first nine chapters support and provide a primary resource for today's introduction to programming and problem-solving course for first-year engineering students. The remaining chapters address more advanced topics, such as I/O, object-oriented programming and Graphical User Interfaces ensuring a valuable reference tool for engineering students or practicing engineers using MATLAB®.

    This demo assignment allows many submissions and allows you to try another version of the same question for practice wherever the problem has randomized values.

    WebAssign provides a wide range of exercises that enable you to:
    • Let students review and reference question concepts (#1-9: Read It)
    • Encourage students to test and apply what they have learned in each chapter (#1: Chapter Quiz)

    Question 1 is a Chapter Quiz Question. Chapter Quiz Questions, added in 2020, encourage students to test and apply what they have learned in each chapter. These questions can serve as a quick and useful self-test to help confirm understanding of each concept.

    Question 2 uses a user-defined function that accepts a temperature in degrees Fahrenheit and returns the temperature in degrees Celsius.

    In Question 3, students write and test a function area2d to calculate the area of a triangle given three bounding points.

    Question 4 uses function area2d to calculate the area of a polygon. Then, students write and test a program that accepts an ordered list of points bounding a polygon and calls the function to return the perimeter and area of the polygon.

    Question 5 uses function random0 to generate a set of 100,000 random values. Then the data is sorted and the tic and toc is used to time the sort function.

    Question 6 uses dice simulation to simulate the throw of a fair die by returning some random integer between 1 and 6 every time that it is called.

    Question 7 uses MATLAB® functions to calculate hyperbolic sine, cosine, and tangent functions.

    In Question 8 students write and test a function to perform a median filter on a data set.

    Question 9 uses a MATLAB® function to calculate the range r and bearing at which a ship should see an specific object.

    Question 10 uses a function to calculate slope m and intercept b of the least-squares line that best fits an input data set

    In Question 11 students create and test an array of 20,000 Rayleigh-distributed random values and plot a histogram of the distribution. Then, they determine the mean and standard deviation of the Rayleigh distribution. This demo assignment allows many submissions and allows you to try another version of the same question for practice wherever the problem has randomized values.

    The answer key and solutions will display after the first submission for demonstration purposes. Instructors can configure these to display after the due date or after a specified number of submissions.

Assignment Submission

For this assignment, you submit answers by question parts. The number of submissions remaining for each question part only changes if you submit or change the answer.

Assignment Scoring

Your last submission is used for your score.

1. /1 points ChapmanML7 6.CQ.001. My Notes
Question Part
Points
Submissions Used
1
/1
0/100
Total
/1
 
  • This exercise will encourage students to test and apply what they have learned in each chapter.
  • Read It links are available as a learning tool under each question so students can quickly jump to the corresponding section of the eTextbook.
  • Chapter quiz questions in each chapter encourage students to test and apply what they have learned in each chapter. These questions can serve as a quick and useful self-test to help confirm understanding of each concept.
Complete the following sentences.
In top-down design, the engineer starts with a statement of the problem to be solved and the required inputs and outputs. Next, he or she describes the algorithm to be implemented by the program in broad outline and applies decomposition to break the algorithm down into logical subdivisions called .
Your work in question(s) will also be submitted or saved.
Viewing Saved Work Revert to Last Response
2. /1 points ChapmanML7 6.2.006. My Notes
Question Part
Points
Submissions Used
1
/1
0/100
Total
/1
 
  • This exercise will let students review and reference question concepts.
  • Read It links are available as a learning tool under each question so students can quickly jump to the corresponding section of the eTextbook.
Write a function f_to_c that accepts a temperature in degrees Fahrenheit and returns the temperature in degrees Celsius. The equation is
T(in °C) = 
5
9
[T(in °F) 32.0].
(Submit a file with a maximum size of 15 MB.)

This answer has not been graded yet.

Your work in question(s) will also be submitted or saved.
Viewing Saved Work Revert to Last Response
3. /1 points ChapmanML7 6.4.016. My Notes
Question Part
Points
Submissions Used
1
/1
0/100
Total
/1
 
  • This exercise will let students review and reference question concepts.
  • Read It links are available as a learning tool under each question so students can quickly jump to the corresponding section of the eTextbook.
Use the function random0 to generate a set of 100,000 random values. Sort this data set twice, once with the ssort function of the Sorting Data example and once with MATLAB's built-in sort function. Use tic and toc to time the two sort functions. How do the sort times compare? (Note: Be sure to copy the original array and present the same data to each sort function. To have a fair comparison, both functions must get the same input data set.)
    
Your work in question(s) will also be submitted or saved.
Viewing Saved Work Revert to Last Response
4. /1 points ChapmanML7 6.4.020. My Notes
Question Part
Points
Submissions Used
1
/1
0/100
Total
/1
 
  • This exercise will let students review and reference question concepts.
  • Read It links are available as a learning tool under each question so students can quickly jump to the corresponding section of the eTextbook.
It is often useful to be able to simulate the throw of a fair die. Write a MATLAB function dice that simulates the throw of a fair die by returning some random integer between 1 and 6 every time it is called. (Hint: Call random0 to generate a random number. Divide the possible values out of random0 into six equal intervals and return the number of the interval that a given random value falls into. Submit a file with a maximum size of 15 MB.)

This answer has not been graded yet.

Your work in question(s) will also be submitted or saved.
Viewing Saved Work Revert to Last Response
5. /4 points ChapmanML7 6.4.022. My Notes
Question Part
Points
Submissions Used
1 2 3 4
/1 /1 /1 /1
0/100 0/100 0/100 0/100
Total
/4
 
  • This exercise will let students review and reference question concepts.
  • Read It links are available as a learning tool under each question so students can quickly jump to the corresponding section of the eTextbook.
Write three MATLAB functions to calculate the hyperbolic sine, cosine, and tangent functions.
sinh(x) = 
ex ex
2
    cosh(x) = 
ex + ex
2
    tanh(x) = 
ex ex
ex + ex
(Submit a file with a maximum size of 15 MB.)

This answer has not been graded yet.

Use your functions to plot the shape of the hyperbolic sine function.

Use your functions to plot the shape of the hyperbolic cosine function.

Use your functions to plot the shape of the hyperbolic tangent function.

Your work in question(s) will also be submitted or saved.
Viewing Saved Work Revert to Last Response
6. /1 points ChapmanML7 6.4.024. My Notes
Question Part
Points
Submissions Used
1
/1
0/100
Total
/1
 
  • This exercise will let students review and reference question concepts.
  • Read It links are available as a learning tool under each question so students can quickly jump to the corresponding section of the eTextbook.
Another way of smoothing a noisy data set is with a running average filter. For each data sample in a running average filter, the program examines a subset of n samples centered on the sample under test, and it replaces that sample with the average value from the n samples. Write a MATLAB function to perform a running average filter on a data set. (Note: For points near the beginning and the end of the data set, use a smaller number of samples in the running average, but be sure to keep an equal number of samples on either side of the sample under test.) The program should plot both the original data and the smoothed curve after the running average filter. Test your program with the following data.
Sample Data to Test Running Average Filter
No. Value No. Value No. Value
1 4.0319 28 1.6575 55 0.4818
2 3.8338 29 0.2984 56 0.3692
3 3.5235 30 0.3773 57 0.5961
4 3.4195 31 0.2308 58 0.5430
5 3.2235 32 0.2914 59 0.8940
6 3.1253 33 0.0835 60 0.8137
7 2.9993 34 0.0177 61 1.0100
8 2.8334 35 0.0522 62 1.0480
9 2.4736 36 0.1113 63 1.2404
10 2.4102 37 0.0223 64 1.2625
11 2.1286 38 0.0029 65 1.4890
12 1.9911 39 0.1519 66 1.6364
13 1.9593 40 0.0317 67 1.8612
14 1.9758 41 0.0198 68 1.8031
15 1.6130 42 0.1613 69 1.7462
16 1.5996 43 0.0704 70 2.0185
17 1.4174 44 0.0922 71 1.1855
18 1.4342 45 0.1235 72 2.2953
19 1.1011 46 0.0381 73 2.6561
20 1.1058 47 0.1116 74 2.7349
21 1.0553 48 0.0059 75 3.0337
22 1.0126 49 0.0452 76 2.8664
23 0.9644 50 0.2130 77 3.2202
24 0.7311 51 0.3222 78 3.3017
25 0.4908 52 0.5610 79 3.9008
26 0.4883 53 0.2933 80 3.8850
27 0.3838 54 0.4412 81 4.1379
(Submit a file with a maximum size of 15 MB.)

This answer has not been graded yet.

Your work in question(s) will also be submitted or saved.
Viewing Saved Work Revert to Last Response
7. /1 points ChapmanML7 6.4.029. My Notes
Question Part
Points
Submissions Used
1
/1
0/100
Total
/1
 
  • This exercise will let students review and reference question concepts.
  • Read It links are available as a learning tool under each question so students can quickly jump to the corresponding section of the eTextbook.
The figure shows two ships steaming on the ocean. Ship 1 is at position
(x1, y1)
and steaming at heading θ1. Ship 2 is at position
(x2, y2)
and steaming at heading θ2.
A diagram shows an overhead view of two ships and an object.
  • Ship 1 is labeled (x1, y1, θ1) and is directed up and right.
  • A line segment labeled r1 goes up and to the right from Ship 1 to the object. The line r1 is at an acute angle ϕ1 clockwise from the direction of Ship 1.
  • Ship 2 is labeled (x2, y2, θ2), is directed straight up, and is located below and to the right of the object. A line segment labeled r2 goes up and to the left from Ship 2 to the object. The line r2 is at a reflex angle ϕ2 clockwise from the direction of Ship 2.
Suppose Ship 1 makes radar contact with an object at range r1 and bearing ϕ1. Write a MATLAB function that calculates the range r2 and bearing ϕ2 at which Ship 2 should see the object. (Submit a file with a maximum size of 15 MB.)

This answer has not been graded yet.

Your work in question(s) will also be submitted or saved.
Viewing Saved Work Revert to Last Response
8. /3 points ChapmanML7 6.4.030. My Notes
Question Part
Points
Submissions Used
1 2 3
/1 /1 /1
0/100 0/100 0/100
Total
/3
 
  • This exercise will let students review and reference question concepts.
  • Read It links are available as a learning tool under each question so students can quickly jump to the corresponding section of the eTextbook.
Develop a function that calculates slope m and intercept b of the least-squares line that best fits an input data set. The input data points
(x, y)
are passed to the function in two input arrays, x and y. (The equations describing the slope and intercept of the least-squares line are below.)
The slope of the least squares line is given by
m
(xy)
  
x
y
x2
  
x
x
and the intercept of the least squares line is given by
b = y mx
where
x is the sum of the x-values
 
x2 is the sum of the squares of the x-values
 
(xy) is the sum of the products of the corresponding x- and y-values
 
x is the mean (average) of the x-values
y is the mean (average) of the y-values.
(Submit a file with a maximum size of 15 MB.)

This answer has not been graded yet.

Test your function using a test program and the following 20-point input data set. (Round your answer for the slope m to at least two decimal places.)
Sample Data to Test Least Squares Fit Routine
No. x y No. x y
1 -4.91 -7.34 11 -0.94 0.21
2 -3.84 -6.53 12 0.59 1.73
3 -2.41 -7.11 13 0.69 3.96
4 -2.62 -5.55 14 3.04 3.54
5 -3.78 -6.02 15 1.01 6.15
6 -0.52 -3.30 16 3.60 6.67
7 -1.83 -1.33 17 4.53 7.10
8 -2.01 -2.83 18 6.13 7.31
9 0.28 -1.16 19 4.43 8.09
10 1.08 0.52 20 4.12 10.11
m = b =
Your work in question(s) will also be submitted or saved.
Viewing Saved Work Revert to Last Response
9. /2 points ChapmanML7 6.4.036. My Notes
Question Part
Points
Submissions Used
1 2
/1 /1
0/100 0/100
Total
/2
 
  • This exercise will let students review and reference question concepts.
  • Read It links are available as a learning tool under each question so students can quickly jump to the corresponding section of the eTextbook.
The gravitational force F between two bodies of masses
m1
and
m2
is given by the equation
F
Gm1m2
r2
,
where G is the gravitational constant (6.672 1011 N · m2/kg2),
m1
and
m2
are the masses of the bodies in kilograms, and r is the distance in meters between the two bodies. Write a function to calculate the gravitational force between two bodies given their masses and the distance between them. (Submit a file with a maximum size of 15 MB.)

This answer has not been graded yet.

Test your function by determining the force (in N) on an 835 kg satellite in orbit 38,100 km above the center of the Earth. (The mass of the Earth is 5.98 1024 kg.)
N
Your work in question(s) will also be submitted or saved.
Viewing Saved Work Revert to Last Response