HW2_7 Write a MATLAB function that plots a line segment & its midpoint. The function should...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
HW2_7 Write a MATLAB function that plots a line segment & its midpoint. The function should take as input m & b (for the line) and two x values for the endpoints of the line. The program should plot the line as a solid black line, and the midpoint as a red circle. The output of the program should be the x,y coordinates of he midpoint. For example, to find the midpoint of y=2x+1 on 0 ≤ x ≤ 10, type this command into the Command Window: >> [xm, ym] =HW2_7 (2,1,0,10) xm = ym = 5 11 Submit your function M-file, a script M-file with this command in it, and the jpg that is created when running the script M-file HW2_8 (Continuation of HW2_7) Write a MATLAB function that does the same task as in HW2_7, but has the input and output contained in arrays. For example, to get the same results as in HW2_7, type >>mid = HW2_8 ([2,1] [0,10]) in the Command Window to get mid = 5 11 25 20 15 10 40 0 0 1 1 1 NI 2 I 3 L 4 - 5 L 6 7 00 8 9 10 Note that the first input contains the slope (m) and intercept (b) in one array, and the second input contains the lower and upper endpoints in a separate array. The output contains the midpoint, both the x and y locations together, also in an array. Submit your function M-file, a script M-file with this command in it except use different input values, and the jpg that is created when running the script M-file. HW2_7 Write a MATLAB function that plots a line segment & its midpoint. The function should take as input m & b (for the line) and two x values for the endpoints of the line. The program should plot the line as a solid black line, and the midpoint as a red circle. The output of the program should be the x,y coordinates of he midpoint. For example, to find the midpoint of y=2x+1 on 0 ≤ x ≤ 10, type this command into the Command Window: >> [xm, ym] =HW2_7 (2,1,0,10) xm = ym = 5 11 Submit your function M-file, a script M-file with this command in it, and the jpg that is created when running the script M-file HW2_8 (Continuation of HW2_7) Write a MATLAB function that does the same task as in HW2_7, but has the input and output contained in arrays. For example, to get the same results as in HW2_7, type >>mid = HW2_8 ([2,1] [0,10]) in the Command Window to get mid = 5 11 25 20 15 10 40 0 0 1 1 1 NI 2 I 3 L 4 - 5 L 6 7 00 8 9 10 Note that the first input contains the slope (m) and intercept (b) in one array, and the second input contains the lower and upper endpoints in a separate array. The output contains the midpoint, both the x and y locations together, also in an array. Submit your function M-file, a script M-file with this command in it except use different input values, and the jpg that is created when running the script M-file.
Expert Answer:
Answer rating: 100% (QA)
The question appears to be a multipart homework assignment involving MATLAB programming It requires writing a MATLAB function to plot a line segment g... View the full answer
Related Book For
An Introduction to the Mathematics of Financial Derivatives
ISBN: 978-0123846822
3rd edition
Authors: Ali Hirsa, Salih N. Neftci
Posted Date:
Students also viewed these programming questions
-
Write a Matlab function to price an European call.
-
Write a Matlab function that will take in two matrices, A, B and will output a matrix of the same size where C(i, j) = max{A(i, j), B(i, j)}
-
Write a MATLAB function that solves tridiagonal systems of equations of size n. Assume that no pivoting is needed, but do not assume that the tridiagonal matrix A is symmetric. Your program should...
-
This is a stocklist case arising under 220(b) of our [Delaware] General Corporation Law. The issue is whether a shareholder states a proper purpose for inspection under our statute in seeking to...
-
Identify some businesses that have recently opened in your area. What are their chances of survival and why? How would you advise the owners or managers of those businesses to enhance their success?
-
Yus determination regarding Transaction 2 should be based on the currency of the: A . loan. B . bank. C . borrower.
-
Daphne Brown-Wright worked as a teacher for East St. Louis School District 189 from 1975 until 1998 and then returned as an administrator from 2002 until 2012, thus serving the District for 33...
-
The adjusted trial balance columns of the worksheet for Alshwer Company, owned by M. Alshwer, are as follows. Instructions (a) Complete the worksheet by extending the balances to the financial...
-
1. The rate at which a bean plant grows is given by a differentiable function R(t). measured in centimeters per day, where 0 st s 30. A graph of the function R is shown below along with a table of...
-
You are considering a purchase of a 4-plex, which is located in a desirable neighborhood. The cost of the property is $500,000. Effective rents are expected to average $1500 per month. Every resident...
-
. The following table shows a breakdown of a student's classification and their major at the Shades College Business Mathematics Psychology In State 55 58 52 Out of State 40 23 45 International 32 64...
-
1. It is possible on the basis of shell model that nucleus with Z = 110 and A = 294 may be exceptionally long-lived. Estimate its nuclear radius.
-
3 3 A ship floating in sea water (density =1020 kg/m displaces 1000m of water. What is the mass of the ship? O 6 1.02x 10 kg 5 5.1x10 kg 6 9.8x 10 kg 5 7.6x10 kg O O
-
2 3 1 point The zero of the Celsius scale corresponds to The boiling point of water The tripple point of water (approximately) Zero absolute pressure No aboslution motion +273.15 K -273.15 K 1 point...
-
An electrostatic air cleaner is a device that removes polluting particulates, thus purifying air. As an example, contaminated air carrying a particulate, with a mass of 3.15 109 kg, will first pass...
-
3 3 A balloon filled with 200 m of helium (density = 0.179 kg/m is rising in air 3 (density = 1.2 kg/m ). how much mass can the balloon left. O 104 kg O 415 kg 204 kg 2000 kg
-
a. b. C. d. Is the restaurant becoming more efficient in the collection of its account receivable? Over the years has more or less money been invested in inventory? Has the working capital increased...
-
On August 31, 2012, the balances of the accounts appearing in the ledger of Wood Interiors Company, a furniture wholesaler, are as follows:Prepare the August 31, 2012, closing entries for Wood...
-
Suppose you are given the following data: ¢ Risk-free yearly interest rate is r = 6%. ¢ The stock price follows: St St1 = μSt + ÏStεt where the...
-
Show that the partial sum is convergent. K! 1
-
Using the data in the previous question, you are now asked to approximate the current value of a European call option on the stock St. The option has a strike price of 100, and a maturity of 200...
-
Evaluate \(\mathbf{T} \cos x\) for the transformation \(\mathbf{T} x=-x\).
-
Evaluate \(\mathbf{T} e^{x}\) for the transformation \(\mathbf{T} x=-x\).
-
Show that the real integers \(1,2, \ldots\) do not form a group under the operation of multiplication.
Study smarter with the SolutionInn App