필터 지우기
필터 지우기

RMSE plot of Monte Carlo simulation

조회 수: 11 (최근 30일)
Sebsatien
Sebsatien 2020년 12월 2일
댓글: Sebsatien 2020년 12월 4일
Hello
I would like your help for this problem that has been bothering me for quite some time.
So, I want to plot the Monte Carlo Simulation of the Root Mean Square Error (RMSE) between a parameter and an estimated parameter
I've written the attached code which was easy enough but the problem is that the plot seems off. From what I know RMSE is supposed to decrease with the number of simulations not oscillate like this.
What I am doing wrong ? And what to do to have a correct plot ?
Thanks in advance
Here's the code :
param = 1 ;
paramest = 1.2 ;
N = 1000;
for n = 1:N
y = param*rand(1,N);
yest = paramest*rand(1,N);
RMSE(n) = sqrt(mean((y - yest).^2));
end
plot(RMSE)
  댓글 수: 3
Sebsatien
Sebsatien 2020년 12월 2일
oh ok. Then I must have misunderstood MC simulation... I thought it was supposed to give the response of a given model in regards to random inputs.
So , I generated "N" random inputs and I wanted to find an output for each input before calculating the RMSE of all the outputs.
So what am I missing ?
Thanks for the reply
KSSV
KSSV 2020년 12월 2일
You are missng the exact problem definition.

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

채택된 답변

Jeff Miller
Jeff Miller 2020년 12월 2일
RMSE is not supposed to decrease with the number of iterations, but it should stabilize.
Your plot oscillates because each point is based on a single estimate--the one generated at each value of n--nothing is being computed cumulatively across iterations. Try changing the end of your script to this:
cumRMSE = cumsum(RMSE) ./ [1:N];
plot(cumRMSE)
  댓글 수: 1
Sebsatien
Sebsatien 2020년 12월 4일
Thank you very much my good sir, you saved my life. =)

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by