Please can someone help me figure out how to add error bars to my timeseries! I am gaving a problem figuring out what the x axis values should be. Would be much appreciated. (I'm new to Matlab!)
I have a timeseries plot that runs Dec 17th - May 30th (alternate days). This is the code for my timeseries plot:
ts1 = timeseries(SSS_SGeast_anom_av_series, 1:2:166);
ts1.Name = ('Average salinity anomaly (psu)');
ts1.TimeInfo.Units = 'days';
ts1.TimeInfo.StartDate = '17-Dec-2020';
ts1.TimeInfo.Format = 'dd mmm yy';
ts.TimeInfo.Increment = '2';
ts1.Time = ts1.Time - ts1.Time(1);
plot(ts1, '- k .', 'MarkerSize', 10, 'Linewidth', 2);
My standard deviation vector is a double numeric vector, size 83 x 1. I want to add this data as error bars on to my timeseries plot, using the command:
I have set y to by the timeseries y values (SSS_SGeast_anom_av_series), and err to be the standard deviation vector mentioned above.
I can't figure out what x values I need to suit the errorbar command above?
I think I need to somehow extract the datetime values from my original timeseries and then use these, but I can't figure out how to get those values.
Either that or make a new vector of the date values, and convert this to datetime. I'm not sure.
Please help if you can! Or let me know if I've been unclear.