hello everyone, I separated the signals from noise by passing them through a low pass filter. I extracted the histogram of the noiseless signals. I tried to fit in matlab. the optimal distributions seem to be exponential and weilbull. I want to calculate the mean square error for these two distributions. I will use whichever distribution has the least error rate. But I don't know how to calculate mean square error. I would be very happy if you could help me with this subject.
signal=1x512712 double

 채택된 답변

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 6월 13일
편집: Sulaymon Eshkabilov 2021년 6월 13일

0 개 추천

Here is the sample code how to compute MSE from the histogram fit model:
x = .... % Your data. You've got it.
% Handle of the figure is needed
HH = histfit(x,Nbins); % HISTOGRAM fit model build. You've got it
%% Separate out the data from HISTOGRAM Plot and Fit Model
Data = get(HH(1),'XData'); % HIST Data
FM = get(HH(2),'YData'); % FIT Model
MD = mean(DATA); % MEAN Of Bins
FM2 = mean(reshape(FM, 2, [])); % Mean Of Bin Edges Fit
ERR = MD - FM2; % ERR
SSE = sum(ERR.^2); % Sum-Squared Error
MSE = mean(ERR.^2); % Mean-Squared-Error

댓글 수: 6

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 6월 13일
You'd need to apply the above procedure for each of them individually.
studentmatlaber
studentmatlaber 2021년 6월 13일
Thank you very much for your answer, but I have a few questions I want to ask.
You said that I have to apply separately for each one. In the code you sent as an example, the index length 'x' is 512712. In other words, the data whose histogram I have drawn consists of 512712 windows. Should I get it in a for loop and have it do it 512712 times? Please excuse my inexperience in this matter.
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 6월 14일
Yes, you may consider the loop in your case.
studentmatlaber
studentmatlaber 2021년 7월 11일
@Sulaymon Eshkabilov Hello again. Could you please take a look at my question in this link? I really can't find the answer. I fit the distribution manually. But now I can't calculate the mean square error of the histogram with manual fit. https://uk.mathworks.com/matlabcentral/answers/868318-how-to-calculate-mean-square-error-in-histogram?s_tid=srchtitle
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 7월 11일
편집: Sulaymon Eshkabilov 2021년 7월 11일
Ok. I'll have a look a bit later today.
studentmatlaber
studentmatlaber 2021년 7월 11일
I'm so sorry, I didn't realize I didn't hit the accept button. I used your solution for auto fit but couldn't adapt it for manual fit.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Signal Generation, Analysis, and Preprocessing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by