plot a polynom with the roots [1,2.3] on the interval (-5,5) with 100 values along with the values of the polynom in the points x=[-pi, 0, e, sqrt(16)] represented by markers. in matlab

Here's how you can plot a polynomial with given roots on a given interval with markers at selected points in Matlab:

main.m
% Define the polynomial with the given roots
roots = [1, 2.3];
p = poly(roots);

% Define the interval and number of values
x = linspace(-5, 5, 100);

% Evaluate the polynomial at the selected points
points = [-pi, 0, exp(1), sqrt(16)];
y = polyval(p, points);

% Plot the polynomial on the interval with markers at selected points
plot(x, polyval(p, x), points, y, 'o')
371 chars
14 lines

This code first defines the polynomial with the given roots using the poly() function. It then defines the interval for plotting and the number of values on that interval using linspace(). The polyval() function is then used to evaluate the polynomial at the selected points. Finally, the plot() function is used to plot the polynomial on the interval with markers at the selected points. The o argument specifies the marker shape.

gistlibby LogSnag