Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2.2) MATLAB Assignment: write a code in MATLAB and Please add comments % to explain the codes. Thank you. 4- Create an array x with

2.2) MATLAB Assignment: write a code in MATLAB and Please add comments "%" to explain the codes. Thank you.

image text in transcribed

4- Create an array x with values which range from -5 to 5 with a step of 0.1. Then create another array f as follows: f - x.^2 +2*x-1. Finally, create a function ff as follows: ff-@(x)x.^2+2*x-1. Notice that both f and ff are attempting to implement the mathematical function f(x) -x'+2x-1. However, only ff is actually a function. The array f simply includes a certain number of values from function f(x). These are the values of f(x) which correspond to those values of the argument x which are equal to the ones found in array x (a) What is the value of k in f(k) so that f(k) is equal to f(2.3)? Put the answer as a comment in your *.m file, and also explain how you calculated/found the correct value of k. Also include f(k) as one line of code, but replace k with the value that you calculated/found (b) What is the value of m in ff(m) so that ff(m) is equal to f(2.3)? Put this answer as a comment in your *.m file, and also explain how you calculated/found the correct value of m. Also, include ff(m) as one line of code, but replace m with the value that you calculated/found. (c) Use x and f to create a plot of the mathematical function f(x) for x ranging from -3 to 3 Show this plot in figure(1). Use a xlabel 'x' and a ylabel 'f(x)'. Add a grid to the plot. (d) Now, use x and ff to create a plot of the mathematical function f(x) for x ranging from -3 to 3. Show this plot in figure(2). Use again a xlabel 'x' and a ylabel 'f(x)'. Add a grid to the plot

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions

Question

Question Can life insurance be used in a Keogh (HR 10) plan?

Answered: 1 week ago