in matlab code please
An "objective function" quantifying the performance to weight ratio for an aircraft design can be expressed as J(x)=q(x)p(x)2 where p(x) and q(x) are both polynomials, and x is an adjustable parameter in the aircraft design. In such problems, it will always be the case that q(x)>0 for all values of x, and that J(x)0 as x. Thus, we know that J(x) achieves a maximal value for some x. The question is, what is the maximizing value of x, and what is the resulting maximal value of J? Assuming that p(x) and q(x) are represented in the workspace by (horizontal) coefficient arrays p and q respectively, write a Matlab script called maxperf .m which will compute and display the (finite, real) value of x for which J(x) is maximized, and the corresponding maximal value of J achieved at this value of x. As an example, if p(x)=2x+5 and q(x)=x4+x2+2x+2 then J(x) has a maximal value of about 12.9 at x=0.27. Note that different p(x) and q(x) will be used to test your script, and the polynomials will generally not have the same,orders. 1.) If you know how, you may be tempted to use symbolic Matlab calculus for this problem. Don't do it! Only numerical calculations with the coefficient arrays can be used in your script. Anything else will be marked incorrect. 2.) Even though we want a purely numerical solution, don't implement a "brute force" grid seareh like we did in some of our previous exercises and examples. We're still going to use some calculus to do the optimization, but in (mostly) numerical form. Specifically. we know a function achieves a (locally) extremal value (min or max) when dJ(x)/dx=0. Differentiating J(x) will again give us a ratio of polynomials (remember your quotient rule here!). Since q(x) is a polymomial taking on only positive values, dJ(x)/dx=0 whereever the numerator polynomial of this expremsion is zero. 3.) Computing the numerator of dJ(x)/dx will require both differentiation and multiplication of polynomials. The function polyder can be used to find the coefficient array for the derivative of a polynomial, while the conv function finds the array corresponding to the product of two polynomials. (For reasons that will be discussed on Monday, neither a*!! nor ".*" when used with coefficient arrays will produce the correct result for polynomial multiplication. However, " + " and "" between coefficient arrays does produce the correct results for polynomial addition and subtraction.) 4.) The extremal values of x may be either minimizing or maximizing values for J(x). They may also be "local maxima", which are not the actual true maximum. You'll need to check the values of J(x) at each extremum to see which is actually the true maximizing value. 5.) It may look like you need to use polynomial division ("deconvolution"; deconv in Matlab) at some point in your calculations. If you think about it, in the context of the comments above, you'll see that this is not actually needed here. Simply evalauate J(x) at each of the extremal points identified (ordinary array arithmetic suffices here), and find out which of these points produces the maximum value for J(x)