plot the polynomial y=0.7x^4-13.5x^2+6x-37 in the domain-5<x<5 in matlab polyval in matlab

To plot a polynomial in Matlab within a certain domain, you can use the polyval function to evaluate the polynomial at a range of points and then plot the resulting curve. Here's how you can do it for the polynomial y=0.7x^4-13.5x^2+6x-37 in the domain -5<x<5:

main.m
% Define the polynomial coefficients
coeff = [0.7 0 -13.5 6 -37];

% Define the range of x values
x = linspace(-5, 5);

% Evaluate the polynomial at each point in x
y = polyval(coeff, x);

% Plot the resulting curve
plot(x, y);
228 chars
12 lines

This will create a plot of the polynomial within the domain -5<x<5.

gistlibby LogSnag