我只有黑线的数据,我想得到黄色区域。 那么如何在MATLAB上获得红线呢? 请帮助我。
答案 0 :(得分:0)
尝试以下示例:
%create a sample periodic curve
t=0:.1:31.4;
upper = (100-t.^2).*cos(t+pi);
%take first derivative of the curve
diff1 = diff(upper);
%find the lowest points of the original curve
lower_x = find([diff1>0 0] & [0 diff1<0]); %rising zero crossings
lower_y = upper(lower_x);
%interpolate between points of the lower curve
lower = spline(lower_x,lower_y,0:size(t,2)-1);
%display
figure; hold on;
plot(t,upper,'b');
plot(t,lower,'r');