How to stem positive part of wave?
2 次查看(过去 30 天)
显示 更早的评论
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/152575/image.png)
0 个评论
采纳的回答
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')
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!