mean square error (MSE) between two graphs
20 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello guys.
I want to calculate the MSE between two curves that I drew but I don't know how to do it. Plot information has different dimensions.
I put the script with the plot of the figures.
The figures start (X,Y) at the zero point.
% practical values
V_red = [0,1,1.62,1.65,1.66,1.67,1.68,1.69,1.69,1.70,1.71,1.71,1.72,1.72,1.73,1.73,1.73,1.74,1.74,1.74,1.75,1.75,1.77,1.78,1.80,1.82,1.84,1.86,1.90,1.91,1.93,1.96,1.98,2.01,2.03,2.05,2.06,2.07,2.12,2.19,2.20,2.21,2.28,2.41,2.52,3.01,3.55]; % volts
I_red_amp = [0,0,0.00005,0.0001,0.00015,0.0002,0.00025,0.0003,0.00035,0.0004,0.00045,0.0005,0.00055,0.0006,0.00065,0.0007,0.00075,0.00080,0.00085,0.0009,0.00095,0.00102,0.00131,0.00152,0.00206,0.00253,0.00324,0.00406,0.00561,0.00631,0.00711,0.00842,0.00967,0.01158,0.01245,0.01367,0.01440,0.01530,0.01851,0.02311,0.02411,0.02630,0.03125,0.04556,0.059,0.1281,0.2485]; % ampere
% LED information
Vt_red = 3.55; % led voltage
Is_red = 0.2485; % LED current
K = 0.5; % can have multiple values of K
imax_red = 0.3; % maximum LED current
SNRdB = -10:2:25;
for sk = 1:length(SNRdB)
for tk = 1:max_run
ss = -10:0.001:24;
iLED_red = Is_red.*(exp(ss./Vt_red) - 1);
xLED_red = iLED_red./((1 + (iLED_red./imax_red).^(2.*K)).^(1./(2.*K)));
end
end
% plot figures
plot(ss,xLED_vermelho_K);
hold on;
plot(V_vermelho,I_vermelho_amp);
xlabel('entry (V)');
hold on;
ylabel('exit (A)');
hold on;
grid on;
the resulting graph is this
0 commentaires
Réponses (1)
Michael
le 1 Nov 2022
Interp them so they are on the same grid and then do the regulare MSE calc?
xLED_vermelho_K_INTERP = interp1(ss,xLED_vermelho_K,V_vermelho)
n = numel(I_vermelho_amp);
MSE = 1/n * sum((xLED_vermelho_K_INTERP - I_vermelho_amp).^2)
2 commentaires
Voir également
Catégories
En savoir plus sur Annotations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!