How to insert error bars in interpolation plot?
5 次查看(过去 30 天)
显示 更早的评论
My plot is a linear interpolation of N scatter points. I'm trying to mark those points as bar errors, and tune the length of the bar errors according to the y axis.
For example: I have a linear interpolation of the gain of an amplifier, I know that the average noise is 100 mV, I want to have a 100 mV bar for each scatter point.
Thank you everyone!
回答(1 个)
Deepak Meena
2020-11-20
Hi Sara,
you can refer to the following documentation to plot error bars in interpolated plots:
Following example illustrate how you can use the above functions :
x = 0:pi/4:2*pi;
v = sin(x);
xq = 0:pi/16:2*pi;
err = 0.5*ones(size(v));
figure
vq1 = interp1(x,v,xq);
plot(x,v,'o',xq,vq1,':.');%%interpolated data
hold on
errorbar(x,v,err);%putting error bars on the original points
so the interpolated data looks like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/420543/image.jpeg)
and the plot with the error bars looks like this
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/420548/image.jpeg)
Hope this helps
Thanks
Deepak
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!