一部の Matlab コードを Python に変換しようとしています。スライスに問題があります。
Matlab コード:
demod_1_b=-1*mod_noisy*2.*sin(2*pi*Fc*t+phi);
y = filter(Hd,demod_1_b);
y2=conv(y,raised)/ConvFac;
%% till this line the length in python and Matlab are same
y2=y2(sa/2:end-(sa/2));
%%%% when i write this line in Python it gives me wrong answer it should come out as 26 but in python it gives me 33 i think i havnt converted it in a rigth way
demod_3_b=y2(sa/2:sa:end);
Python コード:
demod_1_b=-1*mod_noisy*2*sin((2*pi*Fc*t)+phi)
N=10
Fc=40
Fs=1600
d=firwin(numtaps=N,cutoff=40,nyq=Fs/2)
print(len(d))
Hd=lfilter( d, 1.0, demod_1_b)
y2=(convolve(Hd,raised))/Convfac
print(len(y2))
y2=y2[(sa/2)-1:-sa/2]
print(len(y2))
# problem starts here
demod_3_b=y2[(sa/2)-1:sa:,]
print(len(demod_3_a))
私はただ尋ねたいのですがdemod_3_b=y2(sa/2:sa:end);
、Matlab とdemod_3_v=y2[(sa/2)-1:sa:,]
Python は同じですか?