create a graph of y=x^2 in matlab

You can use the plot function in MATLAB to create a graph of y=x^2 as follows:

main.m
x = -10:0.1:10; % define the range of x values
y = x.^2; % define the y values as x squared
plot(x,y) % plot the graph
119 chars
4 lines

This will create a graph of y=x^2 with the x-axis ranging from -10 to 10 in steps of 0.1.

related categories

gistlibby LogSnag