MATLAB: How to create Double Y plots with errobars

plot plotyy errobar

Hello, I guess everything is in the title: I would like to know how to create a double Y plots with errobars. (like a errobaryy function). Thank you for your answer,

Best Answer

My suggestion:
x = 0:0.5:20;
y1 = 200*exp(-0.05*x).*sin(x);
y2 = 0.8*exp(-0.5*x).*sin(10*x);
e1 = rand(size(y1))*20;
e2 = rand(size(y2))/5;
[AX,H1,H2] = plotyy(x,y1,x,y2,'plot');
set(get(AX(1),'Ylabel'),'String','Slow Decay')
set(get(AX(2),'Ylabel'),'String','Fast Decay')
delete(H1)
delete(H2)
axes(AX(1))
hold on
errorbar(x,y1,e1)
axes(AX(2))
hold on
errorbar(x,y2,e2)