binary sine function change its amplitude to minus after a peirod
for example) T=3, Range 0~6
y=sin(t/3) for 0<=t<3
y=-sin(t/3) for 3<=t<6
it reculsively occurs for whole range
6~9, 15~18, ....
9~12, 18~21, ....
how to plot this graph?

 채택된 답변

Akira Agata
Akira Agata 2020년 4월 8일

0 개 추천

How about modulating a phase with 0 <-> pi ?
The following is an example:
T = 3;
time = linspace(0,T*4,1000);
% Create a phase 0 <-> pi
binary = mod(floor(time/3),2) == 1;
phi = pi*binary;
% Plot a phase modulated signal
figure
plot(time,sin(2*pi*(1/T)*time + phi))

추가 답변 (1개)

David Hill
David Hill 2020년 4월 8일

0 개 추천

t=0:.01:30:
y=sin(2*pi*t/3).*(-1).^floor(t/3);%I think you are missing the 2*pi
plot(t,y);

댓글 수: 3

NoYeah
NoYeah 2020년 4월 8일
편집: NoYeah 2020년 4월 8일
I did that expression before the question. but something went crazy depends on frequency and time interval. if any term of floor(blah) is containg fractional exponent, it brings whole results into complex plane and distort whole graph into something strange thing
for example) below yields complex value. not -1
(-1)^(99/10)
David Hill
David Hill 2020년 4월 8일
It works fine for me, floor is never fractional.
NoYeah
NoYeah 2020년 4월 9일
yes but if you set floor set fractional, the result may not correct

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

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

질문:

2020년 4월 8일

댓글:

2020년 4월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by