plot errorbars on graph for selected points

1 回表示 (過去 30 日間)
Mandy de Graaf
Mandy de Graaf 2019 年 11 月 6 日
回答済み: Nikhil Sonavane 2019 年 12 月 23 日
Hi! I want to plot a graph of my datapoints with some errorbars. However, since i have 600 datapoints, i get 600 errorplots. That looks very messy. I wrote a script that enables selection of specific points by clicking on it. A parameter is generated which consists of zeros and only standard deviation values on the clicked datapoints. However when I plot this, it still looks messy because the bars for a standard deviation with value 0 is still displayed. Does anyone know how to get rid of these? Thanks!
This is my script:
(C_av_smooth1 containes my 600 datapoints and std_dev1 containes the standard deviation of each of these points.)
% plot graph and select the points where you want the errorbars
figure;
plot(C_av_smooth1,"LineWidth", 1)
bar_points=int16(getpts());
% list of zeros as long as the amount of data points
stdtest=zeros(1,length(std_dev1));
for i=1:length(stdtest)
for j=1:length(bar_points)
if i==bar_points(j)
stdtest(i)=std_dev1(i);
i=i+1;
end
end
end
% plot graph with errorbars on desired place
figure;
errorbar(C_av_smooth1,stdtest)

回答 (1 件)

Nikhil Sonavane
Nikhil Sonavane 2019 年 12 月 23 日
You can use a for loop to scan your data and neglect data whose standard deviation is zero for plotting error bars.

カテゴリ

Help Center および File ExchangeErrorbars についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by