How to create positive or negative half cycle of sine wave?

조회 수: 17 (최근 30일)
farah piani
farah piani 2016년 1월 13일
답변: Olexander Zhytenko 2016년 3월 2일
I got a full cycle of sine wave. if I need to zero the 1st half of the sine wave , to get only the negative half cycle, what should I do ?I have done this:
close all;
clc;
t=[0 0 0 0 0 1 1.2 1.4 1.6 1.8 2]
f=.5;% Input Signal Frequency
x=sin(2*pi*f*t);% Generate Sine Wave  
plot(t,x);
I wanted an improved version . Is there any other way to do it ?

채택된 답변

Star Strider
Star Strider 2016년 1월 13일
Yes. Rectify it using logical indexing:
t = 0:0.2:2;
f=.5;% Input Signal Frequency
x=sin(2*pi*f*t);% Generate Sine Wave
x(x>0) = 0; % Rectified Sine Wave
plot(t,x);
axis([xlim -1 1])

추가 답변 (1개)

Olexander Zhytenko
Olexander Zhytenko 2016년 3월 2일
I have a different version (see answer file).

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by