Shifting plot to the right

2 ビュー (過去 30 日間)
Wasp Hamberg
Wasp Hamberg 2019 年 2 月 24 日
回答済み: Wasp Hamberg 2019 年 2 月 24 日
There is my code, where i plot Minphase signal. When i try to shift this plot to the right in 2 seconds nothing changes. What is the problem?
f1=20;
f2=100;
df=f2-f1;
dt=0.002;
T=4;
handles.t=0:dt:T-dt;
handles.s=sin(2.*pi.*handles.t.*(f1+(df/((T-dt)*2).*handles.t)));
handles.amp=abs(fft(handles.s));
handles.lnamp=log(handles.amp+1);
cep=ifft(handles.lnamp);
for k=1:1:length(cep)
if k>length(cep)/2
cep(k)=0;
end
if k<(length(cep)/2)
cep(k)=cep(k)*2;
end
end
cep(1)=cep(1)/2;%на нулевой частоте не умножается на 2
handles.minphase=imag(fft(cep));
for k=1:1:length(cep)
handles.minsfft(k)=handles.amp(k).*cos(handles.minphase(k))+handles.amp(k).*j.*sin(handles.minphase(k));
end
handles.mins=real(ifft(handles.minsfft));
figure
plot(handles.t-2,handles.mins)
title('Min-phase signal');
xlabel('Time')
ylabel('Amplitude')
grid on

採用された回答

Wasp Hamberg
Wasp Hamberg 2019 年 2 月 24 日
plot(handles.t-2,fftshift(handles.mins))

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by