📄 sigmoid_art.m
字号:
function [xx, x] =sigmoid_art(N,a,c)% [xx x] = sigmoid_art(N, a, c);% N = length of pulse (in samples)% a and c are parameters of the sigmoid fn - see sigmf.m% % uses SIGMF function to generate artificial baseline shifts. The% rate of which the ramp from 0 to 1 happens depends upon a and c.% Defaults are a=-2; c=5; The more negative a becomes, the steeper % the ramp. If a becomes positive then the signal is inverted.% alues of c other than 5 lead to asymetric waves .. e.g.% [xx x] = sigmoid_art(100,-1,0);% gives a 100 point vector which rapidly ramps to unity from 0 then% drops rapidly back to zero with a discontinuity at the 51st element.% xx produces a continuous pulse where the second half is a mirro reflection% of the first half of the wave.% % see PULSTRAN for generating a continuous time series of this output % (but remember that artefacts are not periodic!!!!)%% See also: SINC_ART, SINC SQUARE, SIN, COS, CHIRP, DIRIC, GAUSPULS, % PULSTRAN, RECTPULS and TRIPULS % Author: G. Clifford, 8-10-03% Copyright 2003 MITif nargin < 3 c = 5; endif nargin < 2 a = -2;endif nargin <1 N = 100; end% make a time vectorspacing = (50/N) * 0.2;t=(spacing:spacing:10);% make a sigmoidy = sigmf(t,[a c]);% normalisey=y/max(y);% reflect at N/2 samplesord = [length(y):-1:1];z=y(ord); %invert it and add it back on.x = [-1*y+1 y];xx = [-1*y+1 -1*z+1];% normalise amplitudex = x/max(x);xx = xx/max(xx);if nargin <1 figure; plot(xx);end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -