Create an input array from -1*pi to 1*pi

조회 수: 3 (최근 30일)
Aaron Kerr
Aaron Kerr 2022년 5월 23일
댓글: Torsten 2022년 5월 25일
% Create an input array from -1*pi to 1*pi
t=[3 4 5 6 7 8 9];
% Calculate |sin(t)|
x=abs(sin(t));
%plot result
plot(t,x);

답변 (1개)

Walter Roberson
Walter Roberson 2022년 5월 23일
% Create an input array from -1*pi to 1*pi
t=-pi:pi;
% Calculate |sin(t)|
x=abs(sin(t));
%plot result
plot(t,x);
  댓글 수: 5
Aaron Kerr
Aaron Kerr 2022년 5월 25일
Thanks, what about if it was t=[0 1 2 3 4 5 6]; what is the "t" refering to.
Torsten
Torsten 2022년 5월 25일
If you set
t=[0 1 2 3 4 5 6];
x=abs(sin(t));
plot(t,x)
MATLAB takes the point (0,abs(sin(0))), (1,abs(sin(1))),...,(6,abs(sin(6))) and connects them in this order by straight lines in the plot.
Same for any array t that you define in advance.

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

카테고리

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

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by