means squared error and dB
显示 更早的评论
For curves in X-Y coordinate system where the Y axis is in decibels (dB), I want to calculate the mean squared error (MSE) between two curves? If the Y values were linear, I could use MSE equation. Can I use MSE when the y values are in dB or should I converts the Y values from dB to linear then compute the MSE and take it to dB?
For instance, Y1 is the y values (in dB) of one curve. Then, Y2 is Y1 values plus or minus a random number from -5 to 5. Therefore, Y2 samples are X dBs above or below those of Y1 where X is in the [-5,5] dB interval.
1) Now that two curves Y1 and Y2 are given in dB, to calculate their MSE, can I use the MSE equation directly or linear conversion is needed (script below)? If the Y values in dB, is there a better way to quantify the average difference than MSE?
Y1=-60:1:60; %y values in dB for curve 1
Y2=Y1+randi([-5,5],size(Y1)) %y values in dB for curve 2
MsedB1 = sum((Y1-Y2).^2)/numel(Y1); %is this MSE correct?
Y1_Lin = 10.^(Y1*0.1); %y values for curve 1 in linear
Y2_Lin = 10.^(Y2*0.1); %y values for curve 2 in linear
MsedB2 = 10*log10(sum((Y1_Lin-Y2_Lin).^2)/numel(Y1_Lin)); %or is this MSE correct?
1 个评论
Mathieu NOE
2020-12-31
hello
the MSE can be expressed in dB, computed as 10*log10(power2/power1) where power1 = sum((Y1_Lin.^2) and power2 = sum((Y2_Lin.^2)
there is no reason to divide by numel(Y1_Lin)
if you want , there is nothing that speaks against defining your own metrics like an averaged dB difference between the two datas
it may give very similar values compare to a "true" MSE in dB and will save a few conversions from dB to lin and vice versa
but your code seems incorrect to me :
MsedB2 = 10*log10(sum((Y1_Lin-Y2_Lin).^2)/numel(Y1_Lin)); %or is this MSE correct? NO !!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Fit Postprocessing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!