Flip signal (positive and negative)

조회 수: 17 (최근 30일)
abdullah qasim
abdullah qasim 2018년 6월 6일
댓글: Image Analyst 2023년 9월 17일
I need help to program a flip-signal to separate the negative signal from the negative and reverse it ?
  댓글 수: 1
Rik
Rik 2018년 6월 6일
Have a read here and here. It will greatly improve your chances of getting an answer.

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

채택된 답변

Image Analyst
Image Analyst 2018년 6월 6일
I have no idea what you want, but take a look at flipping functions flipud() and fliplr(), as well as masking:
negIndexes = signal < 0;
negValuesOnly = signal(negIndexes); % Extract neg values only, or...
% Set negative values to zero (masking)
noNegatives = signal; % Initialize.
noNegatives(negIndexes) = 0; % Set negatives to zero, positives remain as-is.
% Reverse the signal horizontally
reversedSignal = fliplr(signal);
% Invert the signal vertically
signal = max(signal) - signal;
  댓글 수: 4
Souarv De
Souarv De 2023년 9월 17일
@Image Analyst, for inversion of a signal vertically why do you subtract it from the maximum value? Does it not simply the postive values becomes and negative and vice-versa?
Image Analyst
Image Analyst 2023년 9월 17일
You don't have to. You could simply negate it. Like I said, I didn't know what the original poster really wanted.

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

추가 답변 (1개)

Crispin Foli
Crispin Foli 2020년 7월 10일
to flip the signal about the x-axis (negatives to positives and vice versa), simply use the function gnegate (x).
Where X is the signal you're flipping.
This turns all peaks to troughs and all troughs to peaks.

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by