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

조회 수: 1 (최근 30일)
Venkatesh Suriyanarayanan
Venkatesh Suriyanarayanan 2020년 6월 25일
답변: KSSV 2020년 6월 25일
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?

답변 (1개)

KSSV
KSSV 2020년 6월 25일
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.

카테고리

Help CenterFile Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by