How to clip a sine wave on both side?
1 回表示 (過去 30 日間)
古いコメントを表示
I want clip specific portion of both positive and negative side of sine wave.. How to do it. I used MinMax block but it only cliped one side..
0 件のコメント
回答 (1 件)
Image Analyst
2019 年 7 月 5 日
First get the min and max values, then determine the threshold as some fraction from the center and clip:
maxy = max(y)
miny = min(y)
middley = (miny + maxy)/2;
% Determine top point as, say 90% ofthe way from the middle line to the max
fraction = 0.9;
upperThreshold = middley + fraction * (maxy - middley);
lowerThreshold = middley - fraction * (middley - miny);
% Now clip
indexesTooHigh = y > upperThreshold;
y(indexesTooHigh) = upperThreshold;
indexesTooLow = y < lowerThreshold;
y(indexesTooLow) = lowerThreshold;
参考
カテゴリ
Help Center および File Exchange で String Parsing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!