BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / matlab / #11083同步于 2014/7/17
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Matlab机器人发帖

求帮忙看段代码0.0说出原理即可

lindsey95
2014/7/17镜像同步3 回复
嗷0.0 LZ是准大二哒 没学过matlab[ema1] 然后有高中同学希望我求助一下有爱的学长学姐们[ema23] 嗷 这里有段代码 希望能说一下原理 t=0:0.01:20; y=sinc(t-10);%调制 n=length(y); Y=fft(y,n); yy=fftshift(Y); s=cos(60*pi*t)+cos(40*pi*t)+cos(20*pi*t);%载波 n2=length(s); Y1=fft(s,n2); yy1=fftshift(Y1); y1=y.*s;%调幅 n3=length(y1); Y2=fft(y1,n3); yy2=fftshift(Y2); figure(1); subplot(3,2,1);plot(t,y); title('调制信号时域波形');grid on; subplot(3,2,2);plot([0:n-1]*2/(n-1)-1,abs(yy)); title('调制信号频谱图');grid on; subplot(3,2,3);plot(t,s); title('载波信号时域波形');grid on; subplot(3,2,4);plot([0:n2-1]*2/(n2-1)-1,abs(yy1)); title('载波信号频谱图');grid on; subplot(3,2,5);plot(t,y1); title('调幅信号时域波形');grid on; subplot(3,2,6);plot([0:n3-1]*2/(n3-1)-1,abs(yy2)); title('调幅信号频谱图');grid on; [b,a]=butter(8,0.25); %低通 c=filter(b,a,y1);%滤波 将y滤波为c Nc=length(c); C=fft(c,Nc); cc=fftshift(C); figure(2); subplot(3,1,1);plot([0:Nc-1]*2/(Nc-1)-1,abs(cc)); title('低通滤波频域');grid on; [b1,a1]=butter(8,0.5,'high'); %高通 c1=filter(b1,a1,y1); Nc1=length(c1); C1=fft(c1,Nc1); cc1=fftshift(C1); figure(2); subplot(3,1,2);plot([0:Nc1-1]*2/(Nc1-1)-1,abs(cc1)); title('高通滤波频域');grid on; wc=[0.3 0.5]; [b2,a2]=butter(8,wc); %带通 c2=filter(b2,a2,y1); Nc2=length(c2); C2=fft(c2,Nc2); cc2=fftshift(C2); figure(2); subplot(3,1,3);plot([0:Nc2-1]*2/(Nc2-1)-1,abs(cc2)); title('带通滤波频域');grid on; y2=y1.*s;%解调 [b,a]=butter(10,0.1); c3=filter(b,a,y2); figure(3); subplot(3,1,1);plot(t,y); title('调制信号时域波形');grid on; subplot(3,1,2);plot(c3); title('解调信号时域波形');grid on; N=length(c3); C3=fft(c3,N); cc3=fftshift(C3); subplot(3,1,3);plot([0:N-1]*2/(N-1)-1,abs(cc3)); title('解调信号频域');grid on; 咳咳 不用太详细 原理就OK 拜谢有爱的学长学姐[ema23] 下午就要,在线等
订阅后,新回复会通过你的通知中心匿名送达。
3 条回复
Jackhou机器人#1 · 2014/7/17
t=0:0.01:20; y=sinc(t-10);%调制 n=length(y); Y=fft(y,n); yy=fftshift(Y); s=cos(60*pi*t)+cos(40*pi*t)+cos(20*pi*t);%载波 n2=length(s); Y1=fft(s,n2); yy1=fftshift(Y1); y1=y.*s;%调幅 n3=length(y1); Y2=fft(y1,n3); yy2=fftshift(Y2); figure(1); subplot(3,2,1);plot(t,y); title('调制信号时域波形');grid on; subplot(3,2,2);plot([0:n-1]*2/(n-1)-1,abs(yy)); title('调制信号频谱图');grid on; subplot(3,2,3);plot(t,s); title('载波信号时域波形');grid on; subplot(3,2,4);plot([0:n2-1]*2/(n2-1)-1,abs(yy1)); title('载波信号频谱图');grid on; subplot(3,2,5);plot(t,y1); title('调幅信号时域波形');grid on; subplot(3,2,6);plot([0:n3-1]*2/(n3-1)-1,abs(yy2)); title('调幅信号频谱图');grid on; 这个是调制信号和载波进行时域相乘,频域卷积,fft就是快速傅里叶变换
Jackhou机器人#2 · 2014/7/17
[b,a]=butter(8,0.25); %低通 c=filter(b,a,y1);%滤波 将y滤波为c Nc=length(c); C=fft(c,Nc); cc=fftshift(C); figure(2); subplot(3,1,1);plot([0:Nc-1]*2/(Nc-1)-1,abs(cc)); title('低通滤波频域');grid on; [b1,a1]=butter(8,0.5,'high'); %高通 c1=filter(b1,a1,y1); Nc1=length(c1); C1=fft(c1,Nc1); cc1=fftshift(C1); figure(2); subplot(3,1,2);plot([0:Nc1-1]*2/(Nc1-1)-1,abs(cc1)); title('高通滤波频域');grid on; wc=[0.3 0.5]; [b2,a2]=butter(8,wc); %带通 c2=filter(b2,a2,y1); Nc2=length(c2); C2=fft(c2,Nc2); cc2=fftshift(C2); figure(2); subplot(3,1,3);plot([0:Nc2-1]*2/(Nc2-1)-1,abs(cc2)); title('带通滤波频域');grid on; 这个应该是利用巴特沃兹滤波器的函数来构造低通、高通、带通的滤波器,然后就调制后的信号经过滤波器滤波,将滤波后的信号的展成频域出图
Jackhou机器人#3 · 2014/7/17
y2=y1.*s;%解调 [b,a]=butter(10,0.1); c3=filter(b,a,y2); figure(3); subplot(3,1,1);plot(t,y); title('调制信号时域波形');grid on; subplot(3,1,2);plot(c3); title('解调信号时域波形');grid on; N=length(c3); C3=fft(c3,N); cc3=fftshift(C3); subplot(3,1,3);plot([0:N-1]*2/(N-1)-1,abs(cc3)); title('解调信号频域');grid on; 这个不就是解调,然后将输出时域的信号