%% 学习目标:了解波形发生器
%% 方波信号
clear all;
close all;
t=0:0.01:50;
x=(square(t,70)+1)*3; %方波 占空比是70
figure;
plot(t,x,'LineWidth',2);
axis([0,50,0,10]); %坐标轴设置
set(gca,'xlim',[0 50]);
set(gcf,'position',[200,200,400,300]);
%%大仙QQ:1960009019
%%在线教育微信公众号:大仙一品堂
%%大鱼号:在线教育大仙一品堂
%%一点资讯号:大仙一品堂
%% 矩形脉冲信号
clear all;
close all;
t=-8:0.02:8;
y=rectpuls(t,2);
figure;
plot(t,y,'LineWidth',2);
set(gca,'ylim',[0 1.5]);
set(gcf,'position',[200,200,400,300]);
%% 不同的脉冲序列
clear all;
close all;
t1=0:1/50e3:10e-3;
d1=[0:1/1e3:10e-3;0.8.^(0:10)]';
y1=pulstran(t1,d1,'gauspuls',10e3,0.5); % 高斯脉冲序列
t2=0:1/1e3:1;
d2=0:1/3:1;
y2=pulstran(t2,d2,'rectpuls',0.2); % 矩形脉冲序列
figure;
subplot(121);
plot(t1,y1);
subplot(122);
plot(t2,y2);
box off;
set(gca,'ylim',[0 1.2]);
set(gcf,'position',[200,200,800,300]);
%% 压控震荡信号
clear all;
close all;
fs=10000;
t=0:1/fs:2;
y1=sawtooth(2*pi*t,0.75); %先产生三角波
y2=vco(y1,[0.1 0.4]*fs,fs); %三角波作为输入产生压控震荡信号
figure;
subplot(131);
plot(t,y1);
title('三角波');
subplot(132);
plot(t(1:100),y2(1:100));
title('压控振荡器输出波形');
subplot(133);
spectrogram(y2,kaiser(265,5),220,512,fs,'yaxis'); %画压控震荡信号的时频分布图
title('时频分布图');
set(gcf,'position',[200,200,800,250]);
信号处理和滤波去噪:2 波形发生器程序.zip
版权申诉
178 浏览量
2023-05-26
10:06:56
上传
评论
收藏 33.37MB ZIP 举报
JGiser
- 粉丝: 7510
- 资源: 5112