How to create positive or negative half cycle of sine wave?
33 ビュー (過去 30 日間)
古いコメントを表示
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 ?
0 件のコメント
採用された回答
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])
0 件のコメント
その他の回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Specialized Power Systems についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!