MATLAB: Plot function with changing variables

changing variablesno graph

for v = 5:20 d = 20:120
w = (0.25*pi*(d.^2)*0.5*(v.^2))
plot(v,w)
hold on
end
% I am trying to plot v on the x axis, w on the y and vary the variable v between 5 and 20 and d between 20 and 120. I am new to Matlab why won't the graph appear? It just shows a blank white sceen?

Best Answer

The plot function plots lines between two points. You appear to be plotting points, so you need to plot markers.
Try this:
for v = 5:20
for d = 20:120
w = (0.25*pi*(d.^2)*0.5*(v.^2));
plot(v,w,'.')
hold on
end
end
Experiment to get the result you want.