MATLAB Answers

Standard deviation values are to big

4 views (last 30 days)
Nik Rocky
Nik Rocky on 4 Jul 2020
Commented: Nik Rocky on 6 Jul 2020
Hello,
the measures on first pic is a dataset:
later. I change my script and now I create a mean values (between groups 0.5m and 2m) and plot MEAN-Values of both groups and STD deviation:
Mean is right, but std seems are too big!?
Why is this happens? Any idea?
code:
steps_SNR = 15; %%% give step size and be happy
save_plot = 1; %%% print
print_lablepoints = 1; %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
TIME1 = datestr(now, 'dd/mm/yy-HH:MM:SS');
disp('*******************************************************************')
disp('Beginn:')
disp(TIME1)
disp('*******************************************************************')
addpath(genpath('/home/user/workspace/QT/Software_2.0_QT/IO/'));
Res = ('/home/user/workspace/QT/Software_2.0_QT/SORT_RESULTS/End/');
%ah = cd('/home/nikitajarocky/workspace/QT/Software_2.0_QT/IO/RESULTS/VS/');
set(groot, 'DefaultFigureVisible', 'on')
i = dir('**/*.mat');
tic
cla()
M_input_1 = cell(length(i), 1);
M_input_2 = cell(length(i), 1);
M_input_3 = cell(length(i), 1);
M_input_4 = cell(length(i), 1);
plotCount = 1;
legendStrings = [];
Value_Sort = cell(length(i),1);
for j = 1:length(i)
roc_file_folder = i(j).folder;
roc_file_name = i(j).name;
ROC_File_Folder_Name = fullfile(roc_file_folder,roc_file_name);
load(ROC_File_Folder_Name)
disp(roc_file_name)
folder = i(j).folder;
Title_Parts = strsplit(folder, '/');
Motor = Title_Parts{1,end-3};
Motor = strsplit(Motor, '_');
Motor = Motor{1,end};
Mic_Dis = Title_Parts{1,end-1};
Scen = Title_Parts{1,end-2};
Scen = strsplit(Scen, '_');
Scen = Scen{1,end};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SNR_help = ((length(M)-1)/2)*steps_SNR;
SNR = -SNR_help:steps_SNR:SNR_help;
%figure('Name',' receiver operating characteristic','NumberTitle','on');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
str = strsplit(roc_file_name, '_');
str_dist = str{1,4};
str_mic = str{1,5};
if (strcmp(str_dist,'0.5m')|| strcmp(str_dist,'0.5')) && strcmp(str_mic,'AKG')
M_input_1{j} = M;
label1 = extractBefore({i(j).name}, ".mat");
label1 = extractAfter(label1, "_");
elseif strcmp(str_dist,'2m') && strcmp(str_mic,'AKG')
M_input_2{j} = M;
label2 = extractBefore({i(j).name},".mat");
label2 = extractAfter(label2, "_");
elseif (strcmp(str_dist,'0.5m')|| strcmp(str_dist,'0.5')) && strcmp(str_mic,'SONY')
M_input_3{j} = M;
label3 = extractBefore({i(j).name}, ".mat");
label3 = extractAfter(label3, "_");
elseif strcmp(str_dist,'2m') && strcmp(str_mic,'SONY')
M_input_4{j} = M;
label4 = extractBefore({i(j).name}, ".mat");
label4 = extractAfter(label4, "_");
end
for u = 1:length(M)
if print_lablepoints ==1
buffer = [.1 .3 .5];
buffer = repmat(buffer,1,ceil(numel(M(:,2))/numel(buffer)));
buffer(numel(M(:,2))+1:end) = [];
[~, ySortIdx] = sort(M(:,2));
buffer(ySortIdx) = buffer;
end
end
end
M_input_1 = cat(3, M_input_1{:});
M1 = mean(M_input_1, 3);
S1 = std(M_input_1,0,3);
M_input_2 = cat(3, M_input_2{:});
M2 = mean(M_input_2, 3);
S2 = std(M_input_2,0,3);
M_input_3 = cat(3, M_input_3{:});
M3 = mean(M_input_3, 3);
S3 = std(M_input_3,0,3);
M_input_4 = cat(3, M_input_4{:});
M4 = mean(M_input_4, 3);
S4 = std(M_input_4,0,3);
ax = gca;
axes.SortMethod='ChildOrder';
if any(M1)
%plot(M1(:,2),M1(:,1),'-o','DisplayName',label1{1});
errorbar(M1(:,2),M1(:,1),S1(:,2),S1(:,1),'-o','both','DisplayName',label1{1})
legendStrings{plotCount} = label1{1};
plotCount = plotCount + 1;
labelpoints(M1(:,2),M1(:,1), SNR, 'E', buffer)
hold on
end
if any(M2)
%plot(M2(:,2),M2(:,1),'-o','DisplayName',label2{1});
errorbar(M2(:,2),M2(:,1),S2(:,2),S2(:,1),'-o','both','DisplayName',label2{1})
legendStrings{plotCount} = label2{1};
plotCount = plotCount + 1;
labelpoints(M2(:,2),M2(:,1), SNR, 'E', buffer)
hold on
end
if any(M3)
%plot(M3(:,2),M3(:,1),'-o','DisplayName',label3{1});
errorbar(M3(:,2),M3(:,1),S3(:,2),S3(:,1),'-o','both','DisplayName',label3{1})
legendStrings{plotCount} = label3{1};
plotCount = plotCount + 1;
labelpoints(M3(:,2),M3(:,1), SNR, 'E', buffer)
hold on
end
if any(M4)
%plot(M4(:,2),M4(:,1),'-o','DisplayName',label4{1});
errorbar(M4(:,2),M4(:,1),S4(:,2),S4(:,1),'-o','both','DisplayName',label4{1})
legendStrings{plotCount} = label4{1};
plotCount = plotCount + 1;
labelpoints(M4(:,2),M4(:,1), SNR, 'E', buffer)
hold on
end
lgd = legend(legendStrings, 'Interpreter', 'none','Location','best');
title(lgd,'Datasets')
title(['ROC: Motorentyp ',Motor,', Motorengruppe ',Scen,', Konstante ',Mic_Dis],'Interpreter','none')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
help_x = 0:0.1:1;
help_y = 0:0.1:1;
h = plot(help_x,help_y,'--','Color','g');
h.Annotation.LegendInformation.IconDisplayStyle = 'off';
xlabel('False discovery rate')
ylabel('True positive rate')
xlim([0 1]);
ylim([0 1]);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
set(0,'DefaultFigureColor','remove')
file_save = strcat('Motorentyp_',Motor,'Motorengruppe_',Scen,'_Konstante_',Mic_Dis,'.eps');
Full_Export_Path = fullfile(Res,file_save);
if save_plot == 1
export_fig(Full_Export_Path)
end
disp('*******************************************************************')
disp('Time Beginn:')
disp(TIME1)
disp('*******************************************************************')
disp('Time finish:')
TIME2 = datestr(now, 'dd/mm/yy-HH:MM:SS');
disp(TIME2)
disp('*******************************************************************')
toc
Should I use errorbar wrong or std-function?
Thank you!

  0 Comments

Sign in to comment.

Answers (1)

Nik Rocky
Nik Rocky on 4 Jul 2020
Oh, mea culpa - I see, standard deviation bars are not wrong - the results from different measures are really far away from each other! Maybe its a right time to make a laser correction =)
I still left my code here - maybe someone can use it)

  2 Comments

Nik Rocky
Nik Rocky on 6 Jul 2020
Why errorbars has different length? What is wrong?
Nik Rocky
Nik Rocky on 6 Jul 2020
Here is solution:
errorbar(M4(:,2),M4(:,1),S4(:,2),S4(:,2),S4(:,1),S4(:,1),'-v','LineWidth',1.5,'MarkerFaceColor','green','MarkerSize',10,'MarkerEdgeColor','black','DisplayName',label4{1})

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!