Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use matlab and show all codes and work the question continues from this 4. Write a function with header (A, V - myCone (r, h),

image text in transcribed

use matlab and show all codes and work

image text in transcribed

the question continues from this

image text in transcribed

4. Write a function with header (A, V - myCone (r, h), which outputs the total area A and volume of a cone with base radius r and height h. 5. Write a function - myMatrix (myvec, m, n) which creates an m-by-n matrix A, as in Problem 3, but for arbitrary values of mand n and any length of vector myvec. Hint: the function can use the built-in Matlab functions length, mod, and reshape, as well as either a repmat function or a loop. 6. Define an anonymous function heron which calculates the area of a triangle with sides a, b, and cusing Heron's formula. Use this function to calculate the area of a triangle with sides a = myvec (1) + myvec (2). myvec (1) +myvec (3), and c-myvec (2) +myvec (3), where myvec is your answer to Problem 1. 7. Write a function x = realRoots (a, b, c) which outputs real roots of the quadratic equation ax + bx + C = 0. If there are no real roots, then the output is x - 1). Demonstrate the performance of your function on three examples which generate two, one, and no real roots. 8. Consider a triangle with vertices at (-1,0),(1,0), and (0.1). Write a function with the headers - inside Triangle (x,y) where s is the string 'outside if the point with coordinates (x, y) is outside the triangle, 'border' if the point is exactly on the border of the triangle and inside if the point is inside of the triangle. Test you function on the following cases: (x, y)=(-0.5, 0.5).(-1, 1), and (0,0.5). 4. Write a function with header (A, V - myCone (r, h), which outputs the total area A and volume of a cone with base radius r and height h. 5. Write a function - myMatrix (myvec, m, n) which creates an m-by-n matrix A, as in Problem 3, but for arbitrary values of mand n and any length of vector myvec. Hint: the function can use the built-in Matlab functions length, mod, and reshape, as well as either a repmat function or a loop. 6. Define an anonymous function heron which calculates the area of a triangle with sides a, b, and cusing Heron's formula. Use this function to calculate the area of a triangle with sides a = myvec (1) + myvec (2). myvec (1) +myvec (3), and c-myvec (2) +myvec (3), where myvec is your answer to Problem 1. 7. Write a function x = realRoots (a, b, c) which outputs real roots of the quadratic equation ax + bx + C = 0. If there are no real roots, then the output is x - 1). Demonstrate the performance of your function on three examples which generate two, one, and no real roots. 8. Consider a triangle with vertices at (-1,0),(1,0), and (0.1). Write a function with the headers - inside Triangle (x,y) where s is the string 'outside if the point with coordinates (x, y) is outside the triangle, 'border' if the point is exactly on the border of the triangle and inside if the point is inside of the triangle. Test you function on the following cases: (x, y)=(-0.5, 0.5).(-1, 1), and (0,0.5). 4. Write a function with header (A, V - myCone (r, h), which outputs the total area A and volume of a cone with base radius r and height h. 5. Write a function - myMatrix (myvec, m, n) which creates an m-by-n matrix A, as in Problem 3, but for arbitrary values of mand n and any length of vector myvec. Hint: the function can use the built-in Matlab functions length, mod, and reshape, as well as either a repmat function or a loop. 6. Define an anonymous function heron which calculates the area of a triangle with sides a, b, and cusing Heron's formula. Use this function to calculate the area of a triangle with sides a = myvec (1) + myvec (2). myvec (1) +myvec (3), and c-myvec (2) +myvec (3), where myvec is your answer to Problem 1. 7. Write a function x = realRoots (a, b, c) which outputs real roots of the quadratic equation ax + bx + C = 0. If there are no real roots, then the output is x - 1). Demonstrate the performance of your function on three examples which generate two, one, and no real roots. 8. Consider a triangle with vertices at (-1,0),(1,0), and (0.1). Write a function with the headers - inside Triangle (x,y) where s is the string 'outside if the point with coordinates (x, y) is outside the triangle, 'border' if the point is exactly on the border of the triangle and inside if the point is inside of the triangle. Test you function on the following cases: (x, y)=(-0.5, 0.5).(-1, 1), and (0,0.5)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Database Systems For Integration Of Media And User Environments 98

Authors: Yahiko Kambayashi, Akifumi Makinouchi, Shunsuke Uemura, Katsumi Tanaka, Yoshifumi Masunaga

1st Edition

9810234368, 978-9810234362

More Books

Students also viewed these Databases questions