PCM编码:
clear all;
close all;
%建立原信号
dt=0.002; %取时间间隔为0.01
t=0:dt:10; %时域间隔dt为间隔从0到10画图
fc=1 %xt里最大频率
xt=sin(2*pi*fc*t)+cos(2*pi*fc*t); %xt方程
%采样:时间连续信号 变为 时间离散模拟信号
fs=10; %抽样fs=2fc,每秒钟内的抽样点数目将等于或大于2fc个
sdt=1/fs; %频域采样间隔0.1
t1=0:sdt:10; %以sdt为间隔从0到10画图
st=sin(2*pi*fc*t1)+cos(2*pi*fc*t1); %coswt=cos2pift,2pif=w
figure(1);
subplot(311);
plot(t,xt);title(原始信号); %条状图,连续图
grid on %画背景
subplot(312);
stem(t1,st,.); %杆状图 ,离散图
title(抽样信号);
grid on
原创力文档

文档评论(0)