0

ステップのような関数に変換したい連続信号があります(正しい用語が何であるかわかりません)

したがって、信号の下部のすべてのサンプルを 1、中間のものを 2、高いものを 3 に置き換える必要があります。また、ステップのサイズを制御したいと考えています (この例では 3 ですが、変更することができます)。

MATLAB でそれを行うにはどうすればよいですか? 前もって感謝します。

PS

quantとを試しordinalましたが、できませんでした。

4

3 に答える 3

0

heaviside 関数の組み合わせを使用できます。H(x=0)=0.5 の場合もあります。

x=linspace(-1,5);  % your signal to be quantized---- could be anything
y= a*heaviside(x-x1)  + b*heaviside(x-x2) + c;   
% a, b and c decide the heights of your quantization
%   x1 and x2 decide the levels

4番目のレベルが必要な場合は、次を使用してください

y= a*heaviside(x-x1)  + b*heaviside(x-x2) + c*heaviside(x-x3)  +e;

関数はここで定義されています: http://en.wikipedia.org/wiki/Heaviside_step_function

k レベルに量子化するには

    fun=a
    for k=1:n
       fun = fun+ h(i)*heaviside(x-xi(k))
    end
    fun=fun/normalization   % normalization is a number to decide the level of your signal
于 2014-10-18T22:50:11.400 に答える
0

このようなものが欲しいですか?

x = randn(1000, 1); % your signal
y = zeros(size(x));
y(x < -1) = 1;
y(x >= -1 & x < 3) = 2;
y(x >= 3) = 3;

を使用quantileして分位点を取得し、しきい値を決定できます。

于 2014-10-18T22:22:54.103 に答える