일부 Matlab 코드를 파이썬으로 변환하려고합니다. 나는 썰기에 문제가 있습니다.Matlab 대 파이썬 : 조각화
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);
파이썬 코드 :
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);
및 demod_3_v=y2[(sa/2)-1:sa:,]
입니다 물어 싶어?
죄송합니다. 매우 큰 코드 전체를 게시 할 수 없습니다. –
무엇을하려고하십니까? 문제를 증명할 수있는 짧고 독립적 인 실행 가능한 스 니펫으로 코드를 트리밍 할 수 있습니까? – user2357112