Matlab中的阴影区域

时间:2015-10-16 01:52:51

标签: matlab plot colors

以下是我正在使用的代码

Mcand = Multiplicand register

Mplier0 = 0th bit of the Multiplier register (lsb)

Mplier1 = 1st bit of the Multiplier register

Mplier31 = 31st bit of the Multiplier register (msb)

此代码着眼于允许的能带间隙。我想找到当f(x)的绝对值>时的值。 1然后将这些区域遮蔽,因为这些是不允许的状态。所以我发现了x值在哪里 我该怎么做呢?

1 个答案:

答案 0 :(得分:0)

这可以胜任吗?

x = 0.001:0.05:4*pi;
f = cos(x)+10*sin(x)./x;
figure();
hold on
plot(x,f,'r')
axis([0,4*pi,-3,3])
grid on

idx = abs(f) > 1;
ys = zeros(size(x));
ys(idx)=f(idx);
ha = area(x, ys);
相关问题