MATLAB: MATLAB plotting problems…

functionmassmatlab functionplotplotting

I have been trying to plot this graph on matlab or figure out how to go about doing it but everything I seem to do so far does not work. I was hoping I could get some help.
%%Define Variables
g = 9.8;
c = 14;
v=35;
%%Calculations
figure; hold on
for m = 60:70
y(m) = (14*35)/(m*9.8);
end
figure(1); plot(m,y(m));
xlim([60 70]);

Best Answer

Hi David
your code doesn't plot because m is scalar while y is a vector.
command plot requires either a vector, in this case would be y, or 2 vectors.
If you pass a scalar and a vector plot basically does nothing.
try either
plot([60:70],y)
or simply
plot(y)
if you find this answer useful would you please be so kind to consider marking my answer as Accepted Answer?
To any other reader, if you find this answer useful please consider clicking on the thumbs-up vote link
thanks in advance
John BG
Related Question