Error bars not working on loglog plot
Afficher commentaires plus anciens

I am trying to add error bars to a loglog plot and matlab and nothing I try is working. I've gone about it in many different ways including plotting using plot(x,y) then changing the scale to log, using loglog(x,y), and trying errorbarlogx. I dont know why the error is only above the data point for the later points (it shouldnt be). This is my code that made the above graph.
loglog(distance,radiation)
log_distance=log(distance);
log_radiation=log(radiation);
fit=polyfit(log_distance,log_radiation,1)
m=fit(1)
b=fit(2)
z=polyval(fit,log(distance))
hold on;
errorbar(distance,exp(z),combined_error)
What am I doing wong?
4 commentaires
Could you provide the values for inputs to errorbar?
Perhaps the easiest way to share them is to save them to a mat file and attach the file in a comment or within the question.
Also let us know if there are any error message or warnings and, if so, provide the entire error/warning text.
Tim Keegan
le 23 Mar 2022
Tim Keegan
le 23 Mar 2022
Adam Danz
le 23 Mar 2022
See Star Strider's answer.
You may also want to review some log properties
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Annotations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!