dsp.ZeroCrossingDetector: a confusing error
    1 Ansicht (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    parham kianian
      
 am 9 Apr. 2020
  
    
    
    
    
    Beantwortet: Mehmed Saad
      
 am 9 Apr. 2020
            I am trying to employ dsp.ZeroCrossingDetector to count number of zero crossings of a signal. Consider the following:
x = 0 : pi/180 : 4*pi;
y = sin(x);
zcd = dsp.ZeroCrossingDetector;
n = zcd(y);
release(zcd);
It is expected that size of n be 1*1, that is a sclar, but MATLAB  returns n as vector of zeros with the same size as x.
How can I solve this problem?
0 Kommentare
Akzeptierte Antwort
  Mehmed Saad
      
 am 9 Apr. 2020
        dsp.ZeroCrossingDetector needs column vector as an input while you are feeding it a row vector
take transpose of x
x = (0 : pi/180 : 4*pi).'; %Transpose it(.')
y = sin(x);
zcd = dsp.ZeroCrossingDetector;
n = zcd(y);
release(zcd);
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Signal Processing Toolbox finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

