draw the graph of y=x^2 for -10<x<10 and compute y(3). in matlab

main.m
% Define the range of x values
x = -10:0.1:10;

% Calculate y values
y = x.^2;

% Plot the graph
plot(x, y)
xlabel('x')
ylabel('y')
title('Graph of y = x^2 for -10 < x < 10')

% Compute y(3)
x_val = 3;
y_val = x_val^2;
disp(['y(3) = ', num2str(y_val)])
253 chars
17 lines

gistlibby LogSnag