필터 지우기
필터 지우기

Why doesn't the graph show?

조회 수: 1 (최근 30일)
Jessica Lee
Jessica Lee 2015년 10월 21일
댓글: Jessica Lee 2015년 10월 22일
%%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')

채택된 답변

aacarey
aacarey 2015년 10월 21일
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
dpb
dpb 2015년 10월 22일
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.
Jessica Lee
Jessica Lee 2015년 10월 22일
Thank you! I'm not very familiar with the functions of notations as I've just started learning MATLAB so that really helped :)

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

dpb
dpb 2015년 10월 21일
Check what your t actually is (instead of what you intend it to be)...

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by