plot a parabola y = x^2 in the domain [-5,4] in matlab

main.m
% Define the domain and create an array of x values
domain = linspace(-5, 4, 100);

% Create the parabola using element-wise operations
y = domain.^2;

% Plot the parabola
plot(domain, y);

% Label the axes
xlabel('x');
ylabel('y');

% Set the title
title('Parabola: y = x^2');

% Set the limits of the x-axis and y-axis
xlim([-5, 4]);
ylim([0, 16]);
351 chars
20 lines

This code will produce a plot of the parabola y = x^2 in the domain [-5,4] with appropriate axes labels, limits, and title.

gistlibby LogSnag