- 积分
- 4511
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2014-2-9
- 最后登录
- 1970-1-1
|
发表于 2014-2-23 14:58:07
|
显示全部楼层
本帖最后由 沙颖凯 于 2014-2-23 15:03 编辑
% Assume that you have series data X(1, N); corresponding t series t(1, N)
% Set positive and negative data apart
X_positive=zeros([1 length(X)]);
X_negative=X_positive;
X_positive(X>0)=X(X>0);
X_negative(X<=0)=X(X<=0);
% plot in "area"
figure('Color', 'w')
hold on
area(t, X_positive, 'LineStyle', 'none', 'FaceColor', 'r')
area(t, X_negative, 'LineStyle', 'none', 'FaceColor', 'b')
plot(t, X, 'Color', 'k');
hold off
% etc. |
|