How do I colour a band between 2 sets of data of different length

1 view (last 30 days)
Maybe its a very trivial question, but would be glad if someone could thow some light on this..
Say I generate a data x=randn(1,200) and y=4+randn(1,200) and t=1:200. If I want to colour the two sets of data, I am using the following FEX (https://uk.mathworks.com/matlabcentral/fileexchange/13103-plot-confidence-intervals?s_tid=mwa_osa_a)
ciplot(x,y,t,'blue')
However, if I have a data x=randn(1,200), t=1:200 and y=4+randn(1,180), t1=1:180...Is there any way I can colour between these two data sets of unequal length?

Answers (1)

KSSV
KSSV on 25 Jun 2020
x=randn(1,200) ;
t=1:200 ;
y=4+randn(1,180);
t1=1:180 ;
% Append NaN's in y1 to extend it to 1:200.
n = length(t)-length(t1) ;
t1 = t ;
y = [y NaN(1,n)] ;
Now you can use the function. If it is notworking..try to replace NaN's with zeros.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!