# matlab 的指令問題 x = hilber(x);

clear all; close all;

colormap('colorcube');

% Set up constants

fs = 500;% Sample frequency

n = 128;% Signal length divided by four

f1 = 10;% First frequency in Hz

f2 = 40;% Second frequency in Hz

% Construct a step change in frequency

tn = (1:n)/fs;

x = [zeros(n,1); sin(2*pi*f1*tn)'; sin(2*pi*f2*tn)'; zeros(n,1)];

x = hilber(x); % Get Analytic function <----------------------------

[WD,f,t] = wvd(x,fs); % Wigner-Ville Transformation

WD = abs(WD);% Take magnitude

mesh(t,f,WD);% Plot spectogram

xlabel('Time (sec)');

ylabel('Frequency (Hz)');

zlabel('WD(f,t)');

view(70,40);

axis([0 1 0 100 0 200]);

caxis([-100 150]);

%

figure

contour(t,f,WD,[25 75 125 175 225]);% Plot as contour plot

%contour(t,f,WD,[50 100 150 200 250]);% Plot as contour plot

xlabel('Time (sec)');

ylabel('Frequency (Hz)');

axis([0 1 0 80]);

Update:

Rating
• ivan
Lv 5

Matlab 未提供 hilber 指令；

(1)自行建立的function。

(2)版主打錯字→應是hilbert指令

Discrete-time analytic signal using Hilbert transform

語法 x=hilbert(xr)

Source(s): Matlab & Me