How to write sin=(1/2*x)?

Someone know how should I write this function? When I show this code graph doesnt look right.
x= [0:0.01:2*pi];
y= sin(1/2*x);
figure(1);
plot(x,y,'g');

댓글 수: 1

Jan
Jan 2018년 11월 28일
편집: Jan 2018년 11월 28일
"It doesn't look right" does not allow to understand the problem. The posted code does exactly what the posted code does, and it is a valid implementation of the formula. What exactly is the problem?

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

답변 (2개)

madhan ravi
madhan ravi 2018년 11월 28일
편집: madhan ravi 2018년 11월 28일

0 개 추천

Actually your graph looks alright just increase your domain interval
syms x
y=sin((1/2)*x)
fplot(y,[0 6*pi]) % domain is from 0 to 6pi
This is the graph when I increased your domain (in your code)
Screen Shot 2018-11-28 at 7.18.11 PM.png
Michaela Novotna
Michaela Novotna 2018년 11월 28일

0 개 추천

46733590_309733909635859_3153939625282633728_n – kópia – kópia.jpg
I attached file of my code. I dont think that first function is good.

댓글 수: 1

Jan
Jan 2018년 11월 28일
What does "good" mean here? What is the relation of the code to the original question? What do you try to achieve?

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

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품

릴리스

R2018b

태그

질문:

2018년 11월 28일

다시 열림:

2018년 11월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by