MATLAB: Graph won’t display

display problemsgraphnot plottingplotplottingwon't display

I was trying to plot a simple graph of y = x^2 / (pi*(1-x)) but the graph is not displaying
The following code just displayed one point on the graph,
x = linspace(0,10,100)
y = x.^2 / (pi*(1-x))
plot(x,y)
Does anyone know why this is not working?

Best Answer

you need to do element wise operations with a period before:
x = linspace(0,10,100)
y = x.^2 ./ (pi.*(1-x))
plot(x,y)