CONTROL ERRORBAR IN MATLAB

3 ビュー (過去 30 日間)
SULENDER SAHU
SULENDER SAHU 2022 年 4 月 22 日
回答済み: Voss 2022 年 4 月 22 日
I want to plot error bar for my plot. However, I have very large number of data points (close to 1000) and plotting errorbar for each plot makes the graph look very busy. I want to plot eror bar for at specific intervals (say for every 100th data). How do I do that ?
For example i want my plot to look this :
See that that error bars not plotted for every data points.

採用された回答

Voss
Voss 2022 年 4 月 22 日
% some data to plot
x = 1:100;
y = sin(x);
err = randn(size(y));
% 1) busy plot with too many errorbars
ax1 = subplot(2,1,1);
errorbar(x,y,err,'-bs','MarkerFaceColor','r')
% 2) cleaned up plot with fewer errorbars
% (every 10th data point here)
ax2 = subplot(2,1,2);
% plot the line itself first (no errorbars)
plot(x,y);
% now plot the errorbars at every 10th data point
% with no "data" line ('bs' not '-bs' this time)
hold on
errorbar(x(1:10:end),y(1:10:end),err(1:10:end),'bs','MarkerFaceColor','r')
% make the y-limits the same for comparison
set(ax2,'YLim',get(ax1,'YLim'));

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by