clear;
clc;
n=-25:1:25;
f=0.*(n<=-10 & n>=10)+(1-abs(n)/10).*(n>-10 & n<10);
alpha=0.5;
p=2*alpha/pi;
Faf1=frft(f,p);
plot(n,abs(Faf1))
FrFT函数
function Faf = frft(f, a)
% The fast Fractional Fourier Transform 快速分数阶傅立叶变换
% input: f = samples of the signal 样本信号
% a = fractional power 分数幂
% output: Faf = fast Fractional Fourier transform 快速傅立叶变换
error(nargchk(2, 2, nargin));
f = f(:);
N = length(f);
shft = rem((0:N-1)+fix(N/2),N)+1;%时移
sN = sqrt(N);
a = mod(a,4);%a取a/4的余数的模
% do special cases 特殊情况
if (a==0), Faf = f; return; end;
if (a==2), Faf = flipud(f); return; end;%反转
if (a==1), Faf(shft,1) = fft(f(shft))/sN; return; end
if (a==3), Faf(shft,1) = ifft(f(shft))*sN; return; end
% reduce to interval 0.5 < a < 1.5 降至区间(0.5,1.5)
if (a>2.0), a = a-2; f = flipud(f); end
if (a>1.5), a = a-1; f(shft,1) = fft(f(shft))/sN; end
if (a<0.5), a = a+1; f(shft,1) = ifft(f(shft))*sN; end
% the general case for 0.5 < a < 1.5 一般情况下
alpha = a*pi/2;
tana2 = tan(alpha/2);
sina = sin(alpha);
f = [zeros(N-1,1) ; interp(f) ; zeros(N-1,1)];%内插
% chirp premultiplication 左乘
chrp = exp(-i*pi/N*tana2/4*(-2*N+2:2*N-2)'.^2);
f = chrp.*f;
% chirp convolution 卷积
c = pi/N/sina/4;
Faf = fconv(exp(i*c*(-(4*N-4):4*N-4)'.^2),f);
Faf = Faf(4*N-3:8*N-7)*sqrt(c/pi);
% chirp post multiplication 相乘
Faf = chrp.*Faf;
% normalizing constant 量纲归一化
Faf = exp(-i*(1-a)*pi/4)*Faf(N:2:end-N+1);
function xint=interp(x)
% sinc interpolation 插值
N = length(x);
y = zeros(2*N-1,1);
y(1:2:2*N-1) = x;
xint = fconv(y(1:2*N-1), sinc([-(2*N-3):(2*N-3)]'/2));
xint = xint(2*N-2:end-2*N+3);
function z = fconv(x,y)
% convolution by fft fft卷积(x,y的卷积)
N = length([x(:);y(:)])-1;
P = 2^nextpow2(N);
z = ifft( fft(x,P) .* fft(y,P));
z = z(1:N);
我得到的0.5阶FrFT图形
别人得到的0.5阶FrFT图形
请问怎么得到的啊