Flip signal (positive and negative)
    17 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    abdullah qasim
 am 6 Jun. 2018
  
    
    
    
    
    Kommentiert: Image Analyst
      
      
 am 17 Sep. 2023
            I need help to program a flip-signal to separate the negative signal from the negative and reverse it ?
Akzeptierte Antwort
  Image Analyst
      
      
 am 6 Jun. 2018
        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 Kommentare
  Souarv De
      
 am 17 Sep. 2023
				@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
      
      
 am 17 Sep. 2023
				You don't have to.  You could simply negate it.  Like I said, I didn't know what the original poster really wanted.
Weitere Antworten (1)
  Crispin Foli
 am 10 Jul. 2020
        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.
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!