How can I put this MSE equation into MATLAB?

3 Comments

What did you try? A basic Matlab tutorial should be enough to teach you this. Did you do one?
I took a class on MATLAB a few years ago, and am taking a class now that needs it but im a little rusty. I tried the following immse code because I read that MATLAB had this equation built in throughh this function, but it will not run.
err = immse(t1,t2)
fprintf('\n The mean-squared error is %0.4f\n', err);
You can simply use division, sqrt, and .^ to get here.

Sign in to comment.

Answers (1)

You could use immse(), or you can do it manually:
A = randi(100,10,1);
B = A + randn(10,1);
% use immse()
mse1 = immse(A,B)
mse1 = 0.5995
% do the same thing
err = double(A)-double(B); % just in case the inputs are integer-class
mse2 = mean(err(:).^2)
mse2 = 0.5995
EDIT:
I just noticed that's not what the paper is asking for. I have no idea what that expression is supposed to be, but it's not the MSE afaik. Either I'm stupid (it's not uncommon), or someone tried to write the expression for the RMS error and messed it up. Maybe there's some missing context that explains the discrepancy.
This is MSE:
This is RMSE:
I don't know what this is:
Anyone is free to explain what I'm missing.

1 Comment

Good catch. My guess is that this was an attempt at the RMSE. I didn't even notice it wasn't before.

Sign in to comment.

Categories

Find more on Particle & Nuclear Physics in Help Center and File Exchange

Asked:

on 28 Oct 2021

Commented:

Rik
on 29 Oct 2021

Community Treasure Hunt

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

Start Hunting!