Download data1/code/src/+tools/estimate_frequency.m from harsharajkumar273/ReCL-Ultrasound-Dataset: direct link, hf CLI and curl.
- Browser
- Download file 686 Bytes
-
https://huggingface.co/datasets/harsharajkumar273/ReCL-Ultrasound-Dataset/resolve/main/data1/code/src/%2Btools/estimate_frequency.m
- Command line
-
hf download hf://datasets/harsharajkumar273/ReCL-Ultrasound-Dataset/data1/code/src/+tools/estimate_frequency.m
-
curl -L -o estimate_frequency.m https://huggingface.co/datasets/harsharajkumar273/ReCL-Ultrasound-Dataset/resolve/main/data1/code/src/%2Btools/estimate_frequency.m
686 Bytes
| function [fc, bw] = estimate_frequency(data,Fs) | |
| %-- Function | |
| %-- Authors: Alfonso Rodriguez-Molares (alfonso.r.molares@ntnu.no) | |
| %-- Olivier Bernard (olivier.bernard@creatis.insa-lyon.fr) | |
| %-- $Date: 2016/03/01 $ | |
| [fx] = tools.power_spectrum(data,Fs); | |
| fpw = filter(ones(1,26)./26,1,pw);fpw=[fpw(13:end); zeros(12,1)]; | |
| [dc] = max(fpw.*(fx>0).'); fc=fx(ic); | |
| bw_up = min(fx((fx>fc)&(fpw<dc/2).')); %-- -6dB upper limit | |
| bw_do = max(fx((fx<fc)&(fpw<dc/2).')); %-- -6dB down limit | |
| fc = (bw_up+bw_do)/2; %-- center frequency | |
| bw = 2*(bw_up-fc); %-- bandwidth | |
| end | |