Write a Matlab script that accepts the file “FilteredEvidence.wav” and performs the signal processing operations
    9 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Dat
 am 3 Dez. 2022
  
    
    
    
    
    Kommentiert: Walter Roberson
      
      
 am 4 Dez. 2022
            Write a Matlab script that accepts the file “FilteredEvidence.wav” and performs the signal processing operations
This will plot 60 Hz frequency
I upload the FilteredEvidenceFile.wav in Matlab but I got errors message Unrecognized function or variable 'l' when run it.
clearvars;
close all;
ToneFreqHz = 60;
[FilteredEvidence,Fs]=audioread('FilteredEvidenceFile.wav');
NumSamp = size(FilteredEvidence,l);
%Create an array of cosine sample.
CosArray = zeros(NumSamp,l);
for Samp = 1 : NumSamp
    CosArray(Samp) = cos(2*pi*60*Samp/Fs);
end
%Multiply each input sample by the cosine sample.
DemodOut = FilteredEvidence .* CosArray;
%Remove component at 120Hz with a moving average filter.
FirTaps = 1/3675*ones(3675,1);
CosArrayFiltered = filter(FirTaps, l, DemodOut);
0 Kommentare
Akzeptierte Antwort
  Fifteen12
      
 am 3 Dez. 2022
        You use a variable l in your code, but I don't see it defined (line 6). Make sure you set l equal to some value earlier in your script! 
4 Kommentare
  Fifteen12
      
 am 4 Dez. 2022
				l in this case is the dimension of FilteredEvidence you're finding the size of. I'm not sure what dimension you're looking for, though Walter Roberson's suggestion ( l = 1) is as good as any. l is used later on as the denominator coeffecient of the rational transfer function employed in the filter equation (last line). 
If that denominator is coeff is 1, then go ahead and set l equal to 1.
  Walter Roberson
      
      
 am 4 Dez. 2022
				audioread() always returns an N x channels array where N is number of samples. channels is 1 for mono, 2 for stereo (both mono and stereo are common) and higher for possibilities such as Dolby. audioread() never returns a 3D array. So the possible choices for l in size(FilteredEvidence,l) are only 1 (number of samples) or 2 (number of channels) and anything larger would return 1 
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Measurements and Spatial Audio finden Sie in Help Center und File Exchange
			
	Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!