필터 지우기
필터 지우기

Is no graph???

조회 수: 1 (최근 30일)
Khongsin Tinrach
Khongsin Tinrach 2018년 5월 3일
편집: Stephen23 2018년 5월 3일
I am new to matlab and I have some question.Why graph not come out.when I run this code
x = [1 : 0.005 : 4*pi]
y =sin(x)/cos(x);
plot(x,y);
But is work when I change y=sin(x)/cos(x) to y=tan(x) thank you for your answers
  댓글 수: 1
Stephen23
Stephen23 2018년 5월 3일
편집: Stephen23 2018년 5월 3일
Have a look at the size of y:
>> numel(x)
ans = 2314
>> numel(y)
ans = 1
You need to use element-wise rdivide:
sin(x) ./ cos(x)
^ you need this!
Read more about the differences here:

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

답변 (2개)

Yuvaraj Venkataswamy
Yuvaraj Venkataswamy 2018년 5월 3일
Please use this.
x = 1 : 4*pi
y=sin(x)./cos(x);
plot(x,y);
  댓글 수: 1
Khongsin Tinrach
Khongsin Tinrach 2018년 5월 3일
ok now I can do it.thank you

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


KSSV
KSSV 2018년 5월 3일
편집: KSSV 2018년 5월 3일
It is very much working:
x = 1:0.005:4*pi ;
y =sin(x)./cos(x);
% y=tan(x) ;
plot(x,y);
  댓글 수: 1
Khongsin Tinrach
Khongsin Tinrach 2018년 5월 3일
Is working.thank you very much.

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by