Sound Pressure level returning -inf
1 次查看(过去 30 天)
显示 更早的评论
Hello Community;
when I use the function [Lt,Leq,Lpeak,Lmax] = SPL(recording_vector) it returns vectors containing (partially or completely) -inf values. Surprisingly when I re-Run the same line I get usual numeric values. how is this possible? how to avoid it?
Thanks
2 个评论
Chunru
2022-9-2
Can you show your data (a portion) or your code?
It is likely due to the signal amplitude to be 0 so log of it becomes -inf.
采纳的回答
Jimmy Lapierre
2022-9-7
Leq, Lpeak and Lmax are only computed every TimeInterval, so they correspond to the SPL of zero for the first 0.125 seconds. And as chunru said, that corresponds to -Inf. When you call spl a second time, you are already pass the first 0.125 seconds of pure silence.
To avoid it, either discard the fist 0.125 seconds, or set a minimum value you prefer.
For example set any value below -100 dB (including -Inf) to -100:
Leq(Leq<-100)=-100;
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Measurements and Spatial Audio 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!