Guest User

Untitled

a guest
Nov 17th, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. freqAxis = linspace(0,1000,1000)';
  2. freqPeak = 200;
  3. freqPeakAmplitude = 1;
  4. freqGGDExponent = 2;
  5. freqGGDWidth = 50;
  6. freqNoise = 0.2;
  7.  
  8. dataSpectrum = exp(-((freqAxis-freqPeak)/freqGGDWidth).^freqGGDExponent)+freqNoise*rand(size(freqAxis));
  9.  
  10. weightPower = 4;
  11. freqEstLocation = sum((dataSpectrum.^weightPower).*freqAxis)/sum(dataSpectrum.^weightPower);
  12. freqEstDispersion = sqrt(sum((dataSpectrum.^weightPower).*(freqAxis-freqEstLocation).^2)/sum(dataSpectrum.^weightPower));
  13.  
  14. freqEstAmplitude = interp1(freqAxis,dataSpectrum,freqEstLocation);
  15. clf;hold on
  16. plot(freqAxis,dataSpectrum);
  17. plot(freqEstLocation,freqEstAmplitude,'or');
  18. plot([freqEstLocation-freqEstDispersion freqEstLocation+freqEstDispersion],freqEstAmplitude,'xr');
  19. axis tight;grid on
Add Comment
Please, Sign In to add comment