Borrar filtros
Borrar filtros

Plotting error bars on curve

22 visualizaciones (últimos 30 días)
alexandra ligeti
alexandra ligeti el 20 de Jun. de 2024
Comentada: Star Strider el 24 de Jun. de 2024 a las 15:41
Hello,
I have code that compares two devices and I am plotting the error on y-axis throughout a gait cycle % (on the x axis).
I am trying to get the error bars to plot the standard error but I am having an unexpected result when plotting the curve.
This is the code I am working with.
Initially x, ave_diff and SE are 1X1000 and I would like to plot it over a gait cycle from 0-100% hence why I have resampled the signals.
However, when I run this code I have extra values at the end of the plot, yet the resmapled variables are all 101X1?
I cannot spot my error and was wondering if someone my point me in the correct direction or suggest where my fault lies.
I have attached the curve and the area where the issue lies, you can see the standard error bars also become strange.
Thanks in advance
figure()
x = smooth(resample((gc),101,length(gc),'Dimension',1));
ave_diff_resample = smooth(resample((ave_diff),101,length(ave_diff),'Dimension',1));
SE_resampled = smooth(resample((SE),101,length(SE),'Dimension',1));
set(gcf,'Color','w');
%standard error plot
plot(x, ave_diff_resample,'-','Color',[0 0 0],'linewidth',0.5)
hold on
% Adding error bars
errorbar(x, ave_diff_resample, SE_resampled, 'vertical');
hold on
hline = refline(0, 0);
hline.Color = 'k';
xlim([0 100]);
ylim([-15 15]);
legend('Signed Difference', 'Standard error bar')
xlabel('Gait cycle %')
ylabel('Difference (deg)')

Respuesta aceptada

Star Strider
Star Strider el 20 de Jun. de 2024
I really can’t do anything without the data. The rest of the code (that imports the data and processes it including calculating the standard errors) would be helpful as well. (An image may be worth a thousand words, however the data files and code are worth a thousand images on MATLAB Answers.)
pngs = dir('*.png');
for k = 1:numel(pngs)
figure
imshow(imread(pngs(k).name))
end
.
  11 comentarios
alexandra ligeti
alexandra ligeti el 24 de Jun. de 2024 a las 15:19
I think this is exactly what is happening! Thank you :)
Star Strider
Star Strider el 24 de Jun. de 2024 a las 15:41
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by