How to stem positive part of wave?

조회 수: 3 (최근 30일)
vu ngothanh
vu ngothanh 2015년 12월 11일
댓글: vu ngothanh 2015년 12월 12일
Hi everyone,
I have a wave data, I need to show dispersion wave, so I need to "Stem" a "positive part" of the wave (look like the image below). Could you please to help me to solve it.
Thank you in advance.

채택된 답변

Prasad Kalane
Prasad Kalane 2015년 12월 11일
편집: Prasad Kalane 2015년 12월 11일
Try using following code
if true
% code
endx1=rand(1,10);
x2=rand(1,10);
x=[x1 -x2];
subplot(121);stem(x);
title('+ve & -ve Data')
for i=1:length(x)
if sign(x(i))==-1
x(i)=0;
end
end
subplot(122);stem(x);
title('+ve Data')
  댓글 수: 1
vu ngothanh
vu ngothanh 2015년 12월 12일
Thank you very much. It work perfectly.

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

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by