Why doesn't the graph show?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Jessica Lee
el 21 de Oct. de 2015
Comentada: Jessica Lee
el 22 de Oct. de 2015
%%ENGS103P
% Coursework 1
% 21 October, 2015
% Question 2(b)
A=0.009; % m
k=9800; % N/m
m=1; % kg
t=0,0.001,1;
x=A*cos(sqrt(k/m)*t); % m
plot(x,t)
grid on
xlabel('t')
ylabel('x')
title('Graph of x against t')
0 comentarios
Respuesta aceptada
aacarey
el 21 de Oct. de 2015
t = 0,0.001,1; % The commas can be read kind of like "t has the values 0 and 0.001 and 1".
What you need to do instead is use colons
t = 0:0.001:1; % The colons can be read kind of like "t is all the values spanning 0 to 1 in increments of 0.001"
2 comentarios
dpb
el 22 de Oct. de 2015
mmmm....I hate to let the cat out of the bag too easily on homework; would prefer the student find the issue themselves with a little a hint as possible. The learning experience tends to be enhanced that'a'way.
Más respuestas (1)
dpb
el 21 de Oct. de 2015
Check what your t actually is (instead of what you intend it to be)...
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!