⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fskernel.m

📁 很多matlab的源代码
💻 M
字号:
function y = fskernel(ty,n,n0)
% FSKERNEL Fourier Series smoothing kernel.
% 
%	Y = FSKERNEL(TY,N,N0) returns the Fourier series smoothing kernel
%	TY = kernel type TY = 'd' (Dirichlet) or TY = 'f' (Fejer),
%	N =  number of harmonics.
%	N0 = number of intervals (DEFAULT: N0 = 400) 
%	Y returns the kernel evaluated at N0 points
%
%	NOTE: The Dirichlet kernel is: d(t)=sinc[(2*N+1)t]/sinc(t).
%	      The Fejer kernel is:     f(t)=[sinc(Nt)/sinc(t)]^2.
%
%	FSKERNEL (with no input arguments) invokes the following example:
%
%	% To see the Gibbs effect for a square wave reconstructed with 
%	% 5 harmonics, create the Dirichlet kernel with N = 5 and perform its 
%	% periodic convolution with one period of the square wave
%	  >>h = fskernel('d',5,200);              %Dirichlet kernel N=5
%	  >>t = 0:.005:0.995;                     %Time axis (200 points)
%	  >>x = [.5 ones(1,99) 0.5 zeros(1,99)];  %One period of sq wave, T = 1
%	  >>z = convp(x,h,.005);                  %Periodic conv = reconstruct
%	  >>subplot(121),plot(t,h)                %Plot kernel
%	  >>subplot(122),plot(t,z)                %And reconstruction 


% ADSP Toolbox: Version 2.0 
% For use with "Analog and Digital Signal Processing", 2nd Ed.
% Published by PWS Publishing Co.
%
% Ashok Ambardar, EE Dept. MTU, Houghton, MI 49931, USA
% http://www.ee.mtu/faculty/akambard.html
% e-mail: akambard@mtu.edu
% Copyright (c) 1998



if nargin==0,clc,help fskernel
disp(' STRIKE A KEY FOR PLOTS of the above example'),pause
h=fskernel('d',5,200);t=0:.005:0.995;x=[.5 ones(1,99) .5 zeros(1,99)];
z=convp(x,h,.005);
 vx=matverch;
 if vx < 4, eval('clg');else,eval('clf');end
subplot,hold off,subplot(121),plot(t,h),grid
title('Dirichlet kernel N=5'),subplot(122),plot(t,z);grid
title('Reconstruction of square wave'),subplot,return,end

ty=ty(1);
if nargin<3,n0=400;end,
t=0:1/n0:1/2;l=length(t);
if ty=='d',n=2*n+1;end,
y=sinc(n*t)./sinc(t);
if ty=='f',y=y.*y;end
y=n*[y y(l-1:-1:2)];

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -