Met behulp van Matlab probeer ik de instantane frequentie van een (periodiek)signaal te vinden.
Met het softwarepakket Maple is dit al gelukt. Zo heeft de functie sin(x) een hoekfrequentie van 1 rad/s.
Met matlab gebruik ik onderstaande code, waarmee ik volgens mij de juiste waardes verkrijg voor de gebruikte functie x. (gecontroleerd met x).
Daarentegen blijkt er sprake te zijn van in- en uitschakelverschijnselen aangezien het in de plots even duurt voordat de amplitude en instantane frequentie de juiste waarde benadert. Klopt dit?
Code: Selecteer alles
% x is the signal; t is time vector.
Fs=0.01;
P=10*pi;
t=0:Fs:P;
x=sin(t).*cos(t);
% performing the HILBERT TRANSFORM
hx = hilbert(x);
% calculating the INSTANTANEOUS AMPLITUDE (ENVELOPE)
inst_amp = abs(hx);
% calculating the INSTANTANEOUS FREQUENCY
inst_freq = diff(unwrap(angle(hx)))/Fs;
subplot(3,1,1), plot(t,x), title('Modulated signal')
subplot(3,1,2), plot(t,inst_amp), title('Instantaneous amplitude')
subplot(3,1,3), plot(t(1:(length(t)-1)), inst_freq),title('Instantaneous frequency')