SWCtruncated

版本 1.0.2 (2.3 KB) 作者: Linas Svilainis
function [U] = SWCtruncated(t,Wtrue,Signal) Used to get the harmonic component (amplitude and phase) of the Signal at frequency Wtrue
77.0 次下载
更新时间 2021/11/9

查看许可证

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

引用格式

Linas Svilainis (2024). SWCtruncated (https://www.mathworks.com/matlabcentral/fileexchange/68174-swctruncated), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2015a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Spectral Measurements 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.2

Truncation for short signals (1-2 periods) was working wrong.

1.0.1

Minor syntax changes

1.0.0