⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex1_3.m

📁 数字信号处理 实验 的matlab 源码
💻 M
字号:
%1-3
% Q1.17
clear
clf
n=0:40;
f=0.1;
phase=0;
A=1.5;
arg=2*pi*f*n-phase;
x=A*cos(arg);
figure(1)
subplot(411),stem(n,x),axis([0 40 -2 2]),grid on
title('正弦序列 f=0.1'),xlabel('时间序号 n'),ylabel('振幅')
% Q1.20
eng=sum(x.*x);
te=strcat('序列平均幂',num2str(eng));
text(15,1.7,te)

%Q1.22
n1=[0:40;0:40];
f1=[0.9;1.1];
phase1=[0;0];
A1=[1.5;1.5];
for k=1:2
 arg1(k,:)=2*pi*f1(k,1)*n1(k,:)-phase1(k,1);
  x1(k,:)=A1(k,1)*cos(arg1(k,:));
end
subplot(412),stem(n1(1,:),x1(1,:)),axis([0 40 -2 2]),grid on
title('正弦序列 f=0.9'),xlabel('时间序号 n'),ylabel('振幅')
subplot(413),stem(n1(2,:),x1(2,:)),axis([0 40 -2 2]),grid on
title('正弦序列 f=1.1'),xlabel('时间序号 n'),ylabel('振幅')

% Q1.23
n=0:50;f=0.08;phase=90;A=2.5;
arg=2*pi*f*n-phase;
x=A*cos(arg);
subplot(414),stem(n,x),axis([0 40 -2.8 2.8]),grid on
title('正弦序列 f=0.01 A=2.5 phase=90'),xlabel('时间序号 n'),ylabel('振幅')

figure(2)
n=0:40;f=0.1;phase=0;A=1.5;
arg=2*pi*f*n-phase;
x=A*cos(arg);
subplot(311),stem(n,x),axis([0 40 -2 2]),grid on
title('正弦序列 f=0.1 stem'),xlabel('时间序号 n'),ylabel('振幅')
% Q1.24
subplot(312),plot(n,x),axis([0 40 -2 2]),grid on
title('正弦序列 f=0.1 plot'),xlabel('时间序号 n'),ylabel('振幅')
% Q1.25
subplot(313),stairs(n,x),axis([0 40 -2 2]),grid on
title('正弦序列 f=0.1 stairs'),xlabel('时间序号 n'),ylabel('振幅')

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -