plot mean square error

조회 수: 45 (최근 30일)
sally abdulaziz
sally abdulaziz 2015년 8월 16일
답변: NEWAY YIFRU ADAMU 2022년 5월 19일
hi,
i want to plot mean square error in matlab
i use the code: MSE=mean((YP-Yd).^2);
it gives me only one value, i want to know a code that gives me a vector to plot it
thanks in advance
  댓글 수: 1
Azzi Abdelmalek
Azzi Abdelmalek 2015년 8월 16일
Can you explain? You have two vectors YP and Yd, the mean of YP-Yd is one number, why are you expecting the result to be a vector?

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

채택된 답변

dawit mamo
dawit mamo 2020년 3월 7일
you have to use for loop for iteration through your data length or if you are using filter then put filter length as a value for iteration like
N = length(input);
for i = 1:N-1
mse(i) = mean((y(i)-x(i)).^2)
end
plot(abs(mse))
  댓글 수: 1
studentmatlaber
studentmatlaber 2021년 7월 11일
@dawit mamo hi. 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

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

추가 답변 (1개)

NEWAY YIFRU ADAMU
NEWAY YIFRU ADAMU 2022년 5월 19일
t= length(simulation_time);
for i = 1:t
mse(i) = mean((y(i)-x(i)).^2)
end
plot(abs(mse))
%% or
for i = 1:t
mse(i) = mse(i)+ mean((y(i)-x(i)).^2)
end
plot(abs(mse))

Community Treasure Hunt

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

Start Hunting!

Translated by