Recovering shape of periodically sampled signal in near resonance conditions
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Periodic signal with frequency Fs has sampled with frequency Fo. How can we recover the signal's shape if Fs is close to Fo or one of its harmonics, so the period of a beating frequency takes hundreds of thousands of samples?
Thanks for detailed answer
3 Kommentare
Sulaymon Eshkabilov
am 31 Jan. 2023
No, I don't. By following their guidelines, one can write a decent code to get the job done.
Antworten (4)
Sulaymon Eshkabilov
am 28 Feb. 2023
There are several fucntions of MATLAB which can be used in such exercises. They are interp1(), interp2, interpn,pchip, spline, griddedInterpolant, scatteredInterpolant, etc. Here is one example how it can be attained.
% Given:
F = [0 1 3 1 0 -1 -3.5 -2 -1 0]; % Given signal
T = [0 1 3 4 7 8 10 11 12 13]; % Time intervals corresponding
% Note that T is non-uniform
% This how to perform interpolation:
dt = 0.2; % Sampling time interval, s
fs = 1/dt; % Sampling frequency, Hz
ti = T(1):1/fs:T(end); % Time
FF = griddedInterpolant(T, F); % Grid interpolation w.r.t ti's time intervals
fi = FF(ti);
figure(1)
plot(T,F, 'ro-', 'DisplayName', 'Data')
hold on
plot(ti, fi, 'k-.', 'Linewidth',2,'DisplayName', 'Interpolated data')
grid on
legend show
hold off
%% Uniform time interval: Note the difference
% Given:
F = [0 1 3 1 0 -1 -3.5 -2 -1 0]; % Given signal
T = 0:9; % Time intervals are uniform
% Note that T can be also non-uniform
% This how to perform interpolation:
dt = 0.2; % Sampling time interval, s
fs = 1/dt; % Sampling frequency, Hz
ti = T(1):1/fs:T(end); % Time
% FF = griddedInterpolant(T, F); % Grid interpolation w.r.t ti's time intervals
% fi = FF(ti);
fi = interp1(T,F, ti, 'makima');
figure(2)
plot(T,F, 'ro-', 'markerfacecolor', 'c', 'DisplayName', 'Data')
hold on
plot(ti, fi, 'k-.', 'linewidth',2, 'DisplayName', 'Interpolated data')
grid on
hold off
legend show
Sulaymon Eshkabilov
am 28 Feb. 2023
As understood your question correctly, is that you are trying to get the shape function which is the envelope thata can be computed by the following fcn of MATLAB - envelope() - see this example:
% DATA: your data
fm = 5; % Freq 1
fc = 100; % Freq 2
dt = 0.001; % Sampling time interval, s
fs = 1/dt; % Sampling frequency, Hz
t= 0:1/fs:1; % Time
Am=3;
Ac = 3;
Ka = .75;
m = Am*cos (2*pi*fm*t);
S = Ac*(1 + Ka*m).* cos(2*pi*fc*t);
%%
% ENvelope is computed here:
[EUp, ELow]=envelope(S); % Upper and Lower envelopes are computed here
plot(t,S)
hold on
plot(t, EUp, 'r-'),
plot(t, ELow, 'r-')
legend('Data', 'Envelope')
grid on
xlabel('Time, [s]')
ylabel('Signal')
3 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!