Error Bars Matlab Loglog
Contents |
Support Answers MathWorks Search MathWorks.com MathWorks Answers Support MATLAB Answers™ MATLAB Central Community Home MATLAB Answers File Exchange Cody Blogs Newsreader Link Exchange ThingSpeak Anniversary Home Ask
Errorbarlogx
Answer Browse More Contributors Recent Activity Flagged Content Flagged as Spam Help matlab errorbarlogx MATLAB Central Community Home MATLAB Answers File Exchange Cody Blogs Newsreader Link Exchange ThingSpeak Anniversary Home Ask Answer Browse
Matlab Errorbar Log Scale
More Contributors Recent Activity Flagged Content Flagged as Spam Help Trial software MathWorks Support Team (view profile) 13,593 questions 13,593 answers 13,592 accepted answers Reputation: 2,574 Vote0 How can I use errorbarlogy the ERRORBAR function with a logarithmic axis in MATLAB? Asked by MathWorks Support Team MathWorks Support Team (view profile) 13,593 questions 13,593 answers 13,592 accepted answers Reputation: 2,574 on 27 Jun 2009 Latest activity Commented on by Ohad BarSimanTov Ohad BarSimanTov (view profile) 0 questions 0 answers 0 accepted answers Reputation: 0 on 27 Jul 2016 Accepted Answer by MathWorks Support Team horizontal error bars matlab MathWorks Support Team (view profile) 13,593 questions 13,593 answers 13,592 accepted answers Reputation: 2,574 227 views (last 30 days) 227 views (last 30 days) When I type the following at the MATLAB prompt, I get a an errorbar with a log x axis:x = 1:100; y = sin(x); e = std(y)*ones(size(x)); errorbar(x,y,e) set(gca,'xscale','log') However, the errorbars of the first point in the resulting figure extend much farther than the other errorbars. I would like a function that can account for the logrithmic X-axis and make all of the errorbars have a uniform width. 1 Comment Show all comments Ohad BarSimanTov Ohad BarSimanTov (view profile) 0 questions 0 answers 0 accepted answers Reputation: 0 on 27 Jul 2016 Direct link to this comment: https://www.mathworks.com/matlabcentral/answers/99844#comment_381798 This is what I got after using others comments, here and stack overflow.errorbar(X,Y,E,'bo','linewidth',2) c=get(gca,'Children'); for i=1:length(c); set(c(i),'XData',get(c(i),'YData'),'YData',get(c(i),'XData')); end; axis([10^-5 10^-3 0.4 1]) % This is just to set the (Y and X) axis (flipped) set(gca,'xscale','log'); % set X log scale view(-90, 90) % Swap the axes if you want Y log scale (you can ignore from here on) set(gca, 'ydir', 're
toolboxes, and other File Exchange content using Add-On Explorer in MATLAB. » Watch video Highlights from errorbarlogx.m errorbarlogx(epsilon)ERRORBARLOGX Homogenize the error bars for X-axis in log scale. View all files Join the 15-year community celebration. Play games and win prizes! » Learn more 4.95238 5.0
Error Bar Width Matlab
| 21 ratings Rate this file 17 Downloads (last 30 days) File Size: 2.04 KB File errorbar matlab ID: #9715 Version: 1.0 errorbarlogx.m by Frederic Moisy Frederic Moisy (view profile) 14 files 323 downloads 4.25151 21 Jan 2006 (Updated 24 Jan 2006) Error bar plot for X-axis in log scale | Watch this File File Information Description ERRORBARLOGX Homogenize the error bars for X-axis in log scale. ERRORBARLOGX turns the X-axis of the current error bar plot to log https://www.mathworks.com/matlabcentral/answers/99844-how-can-i-use-the-errorbar-function-with-a-logarithmic-axis-in-matlab scale, and homogonizes the length of the horizontal segements which terminate the vertical error bars. By default, Matlab's ERRORBAR draws vertical error bars which are terminated by small horizontal segments of uniform length for the X-axis in linear scale. But when turning the X-axis to log scale, these segments become uneven. Using ERRORBARLOGX makes them uniform again. ERRORBARLOGX(N) specifies the relative length of the horizontal segments, normalized with the total range of the data. By https://www.mathworks.com/matlabcentral/fileexchange/9715-errorbarlogx-m default, N=0.01 is used. Limitations: ERRORBARLOGX acts only on the last drawn curve. If this curve is not an error bar plot, it won't work. Example: x=logspace(1,3,20); y=5*(1 + 0.5*(rand(1,20)-0.5)).*x.^(-2); errorbar(x,y,y/2,'o-'); errorbarlogx(0.03); Acknowledgements This file inspired Eb Ticklength, Errorbarlogy, and Superbar. MATLAB release MATLAB 7.0.1 (R14SP1) Tags for This File Please login to tag files. error bar plotgraph typesgraphicslog scaleplottingspecializedxaxis Cancel Please login to add a comment or rating. Comments and Ratings (24) 03 Dec 2015 Mario Koddenbrock Mario Koddenbrock (view profile) 0 files 0 downloads 0.0 04 Apr 2015 Sergei Paleichuk Sergei Paleichuk (view profile) 0 files 0 downloads 0.0 15 Oct 2012 Emily Emily (view profile) 0 files 0 downloads 0.0 19 Sep 2011 David Collins David Collins (view profile) 0 files 0 downloads 0.0 02 Mar 2011 Miguel Ullan Miguel Ullan (view profile) 0 files 0 downloads 0.0 Elegant. 23 Jul 2010 Audrey Audrey (view profile) 0 files 0 downloads 0.0 The image is loglog errorbar, which is I need, but the code is logx error bar, can someone tell how to make the loglog happen? Comment only 02 Jul 2010 Danmei Bian Danmei Bian (view profile) 0 files 0 downloads 0.0 Thank you so much! 29 Sep 2008 Leonardo Sepulveda Excellent. Easy to use. 19 May 2008 Vincent G. Great, it saved my day! Thanks a lot! 16 Apr 2008
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack http://stackoverflow.com/questions/4393868/plotting-errorbars-in-the-logarithmic-domain-with-negative-values-matlab Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Plotting errorbars in the logarithmic domain with negative values (Matlab) up vote 3 down vote error bar favorite 1 I have a vector, call it x, which contains very small numbers that I calculated from a mean. I'd like to plot the logarithmic transform of x, say y=10*log10(x), along with errorbars equal to +- 2 standard deviations calculated when finding the mean. To do this, I'm using the following code: figure errorbar(lengths, 10*log10(x), ... 10*log10(x-2*std_x), 10*log10(x+2*std_x), 'o') My problem is that since x contains such small values, x-2*std_x error bars matlab is usually a negative number, and you can't take the log of negative numbers. So I suppose my question is how can I plot errorbars in the logarithmic domain when subtracting the standard deviation in the linear domain gives me negative numbers? I can't do the +- matlab plot logarithm share|improve this question edited May 4 '12 at 23:42 CharlesB 42.2k11117136 asked Dec 9 '10 at 0:49 Josiah 3891822 this also means that the error bar meaning isn't quite right - the error bars assume a gaussian distribution, and nonnegativity means that it's not gaussian. but I still understand why you would do this, and it's still reasonable :) –Peter Dec 9 '10 at 1:05 add a comment| 3 Answers 3 active oldest votes up vote 1 down vote accepted You can replace those values with a small value but log-able (say, 40 dB lower): minb = x-2*std_x; mask = (minb <= 0); minb(mask) = x/1e4; ... use 10*log10(minb) instead Or just threshold to some minimum: K = min(x) / 1e4; % so that K is 40 db below the smallest x ... use 10*log10(max(K, x-2*std_x)) instead. Or similar stuff. EDIT to summarize comments and further thoughts: One should probably think about why have error bars. Normally error