SWCtruncated
Versione 1.0.2 (2,34 KB) da
Linas Svilainis
function [U] = SWCtruncated(t,Wtrue,Signal) Used to get the harmonic component (amplitude and phase) of the Signal at frequency Wtrue
Extracts the harmonic component of the Signal at angular frequency Wtrue. Can be used as sinusoid amplitude and phase estimator if frequency is known or as a narrowband filter extracting particular frequency component from the signal. Equivalent to Fourier transform, just frequency is not limited to Fourier bins.
Uses sine wave correlation (SWC). More details in:
L.Svilainis, et al. The Automated Complex Impedance Measurement System. Electronics and Electrical Engineering. 2007. Nr. 4(76),pp. 59-62. Available at: http://eejournal.ktu.lt/index.php/elt/article/view/10720
Other m-files required: none
Subfunctions: none
MAT-files required: none
Authors: Linas Svilainis
Kaunas University of Technology, Dept. of Electronics Engineering,
Kaunas, Lithuania
email address: linas.svilainis@ktu.lt
December 2006; Last revision: 10-Jul-2018
Copyright: Linas Svilainis
Syntax: [U] = SWCtruncated(t,Wtrue,Signal)
Inputs:
Signal - (1,N) array of sampled signal values
t - time axis,(1,N) array, must be same length as Signal
Wtrue - angular frequency for estimation (2*pi*F)
Outputs:
U - measured complex amplitude of the sinusoid
Notes:
The more periods you record the better is noise or other frequencies rejection, the better estimation accuracy;
Recond length is truncated to aproximately fit the integer number of frequency Wtrue periods;
Time axis t must be sampled equally;
Example (TestSWC)
clear all
fsampl=100e6;%sampling frequency is 100MHz
f0=1.3012e6;%sinusoid frequency is 1.3012MHz
phi=30/180*pi;%sinusoid phase is 30deg
Um=0.141;%sinusoid amplitude is 0.141V
N=100;%record length is 1000 samples
%make time axis:
t=(0:(N-1))/fsampl;
%generate test signal:
MySignal=Um*cos(2*pi*f0*t+phi);
%add some noise:
MySignal=MySignal+0.01*randn(1,N);
%estimate signal amplitude and phase:
Uest = SWCtruncated(t,2*pi*f0,MySignal);
Umag=abs(Uest)
Uph_rad=angle(Uest)
Uph_deg=Uph_rad/pi*180
%plot the raw signal and estimated harmonic component:
figure(1)
plot(t*1e6,MySignal,'r',t*1e6,Umag*cos(2*pi*f0*t+Uph_rad),'k')
xlabel('Time, us')
ylabel('Amplitude, V')
grid on
axis tight
Cita come
Linas Svilainis (2024). SWCtruncated (https://www.mathworks.com/matlabcentral/fileexchange/68174-swctruncated), MATLAB Central File Exchange. Recuperato .
Compatibilità della release di MATLAB
Creato con
R2015a
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS LinuxCategorie
Scopri di più su Spectral Measurements in Help Center e MATLAB Answers
Tag
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Scopri Live Editor
Crea script con codice, output e testo formattato in un unico documento eseguibile.