In: Mechanical Engineering
Use MATLAB to plot the polynomial y = 3x4 - 5x3 - 28x2 - 5x + 200 on the interval $1 ≤ x ≤ 1. Put a grid on the plot and use the ginput function to determine the coordinates of the peak of the curve.
We are required to plot the polynomial
y = 3x4 – 5x3 – 28x2 – 5x + 200
Over the interval
-1 ≤ x ≤ 1
We need to create a vector x and evaluate the polynomial at each element of vector x. We can use the function polyval(a, x) which is use to evaluate the polynomials.
Here:
a is the polynomial array
x is the vector array
The below MATLAB code shows the commands
The plot generated is shown below:
Now, we use the ginput function to calculate the coordinates of the peak of the function. The command used is [x, y] = ginput. Then we need to click on the highest point and click enter. The results will appear on the screen.
The output is shown below:
Hence, we get the coordinated of the peak of the curve as:
x = -0.0853
y = 200.2770
Hence, we get the coordinated of the peak of the curve as:
x = -0.0853
y = 200.2770