224k views
4 votes
Which of the following MATLAB commands will plot the function y = 3x^3-26x + 10, and its first and second derivatives, for -2 ≤ x ≤ 4, all in the same plot?

A. plot(-2:0.1:4, 3x^3-26x + 10, 'r', diff(3x^3-26x + 10), 'g', diff(diff(3x^3-26x + 10)), 'b')

B. plot(3x^3-26x + 10, -2:0.1:4, 'r', diff(3x^3-26x + 10), 'g', diff(diff(3x^3-26x + 10)), 'b')

C. plot(-2:0.1:4, diff(3x^3-26x + 10), 'r', diff(diff(3x^3-26x + 10)), 'g', 3x^3-26x + 10, 'b')

D. plot(diff(3x^3-26x + 10), -2:0.1:4, 'r', diff(diff(3x^3-26x + 10)), 'g', 3x^3-26x + 10, 'b')

1 Answer

0 votes

Final answer:

The correct MATLAB commands to plot the function y = 3x^3-26x + 10, along with its first and second derivatives, for -2 ≤ x ≤ 4, are: plot(-2:0.1:4, 3x^3-26x + 10, 'r'), hold on, plot(-2:0.1:4, diff(3x^3-26x + 10), 'g'), plot(-2:0.1:4, diff(diff(3x^3-26x + 10)), 'b').

Step-by-step explanation:

The correct MATLAB commands to plot the function y = 3x^3-26x + 10, along with its first and second derivatives, for -2 ≤ x ≤ 4, are:

plot(-2:0.1:4, 3x^3-26x + 10, 'r')

hold on

plot(-2:0.1:4, diff(3x^3-26x + 10), 'g')

plot(-2:0.1:4, diff(diff(3x^3-26x + 10)), 'b')

This will plot the original function in red, the first derivative in green, and the second derivative in blue, all on the same plot.

User Fredarin
by
7.6k points