信号的产生和运算

① 单位阶跃序列 u[n] 和 u[n+7]

clear ; clc; close all;
% Generate a vector from -10 to 20
n = -10:20;
% Generate the unit sample sequence
x = [zeros(1,10) 1 zeros(1,20)];
% Plot 
subplot(1,2,1);
stem(n,x);  % u[n]
xlabel('n');ylabel('\delta[n]'); 
M = 7;
xd = [zeros(1,10-M) 1 zeros(1,20+M)];
subplot(1,2,2);
stem(n,xd); % u[n+7]
xlabel('n');ylabel('\delta[n+7]');

② 产生复指数序列用左右两张子图分别画出该序列的实部和虚部

% Generation of a complex exponential sequence
clear ; clc; close all;
c = 0.2 + 3 * i;
K = 1.5;
n = 0 : 15;
x = K * exp(c * n);
subplot(2,1,1);
stem(n,real(x));
xlabel('n');ylabel('Amplitude');
title('Real part');
subplot(2,1,2);
stem(n,imag(x));
xlabel('n');ylabel('Amplitude');
title('Imaginary part');

 ③ 产生并画出实指数序列

% Generation of a real exponential sequence
clear ; clc; close all;
n = 0 : 15; 
a = 0.8; 
K = 2;
x = K * a.^n;
stem(n,x);
xlabel('n');ylabel('Amplitude');

 ④ 产生并画出正弦序列

% Generation of a sinusoidal sequence
clear ; clc; close all;
n = 0:49;   
A = 2.5;
w = 0.16 * pi;
phase = pi / 2;
x = A * cos( w * n + phase);
clf; 
stem(n,x); % Plot the generated sequence
axis([0 50 -3 3]);
grid; 
title('Sinusoidal Sequence');
xlabel('n');
ylabel('Amplitude');

⑤ 产生序列 x[n] = {1,2,3,4}, 0 ≤ n ≤ 3      y[n] = {3,4,5,6}, 0 ≤ n ≤ 3
                   w1[n] = x[n] + y[n]  0 ≤ n ≤ 3   w1[n] = x[n] * y[n]  0 ≤ n ≤ 3

clear ; clc; close all;
n = 0 : 3;
x = [1 2 3 4];
y = [3 4 5 6];
w1 = x + y;
w2 = x .* y;
subplot(2,2,1);     stem(n,x);
xlabel('n');ylabel('x[n]');     title('x[n]序列');
subplot(2,2,2);     stem(n,y);
xlabel('n');ylabel('y[n]');     title('y[n]序列');
subplot(2,2,3);     stem(n,w1);
xlabel('n');ylabel('w1[n]');     title('w1[n]序列');
subplot(2,2,4);     stem(n,w2);
xlabel('n');ylabel('w2[n]');     title('w2[n]序列');

⑥  产生序列 x[n] = {1,2,4,-5,-2}, -2 ≤ n ≤ 2 , 计算奇偶部并画图

        任何实序列都可以表示成其偶部与其奇部之和:

 

clear ; clc; close all;
n = -2 : 2;
x = [1 2 4 -5 -2];
m = n + 3;
ev = (x(m) + x(6 - m)) / 2 ;
od = (x(m) - x(6 - m)) / 2 ;
subplot(3,1,1);     stem(n,x);
xlabel('n');ylabel('x[n]');     title('x[n]序列');
subplot(3,1,2);     stem(n,ev);
xlabel('n');ylabel('xev[n]');    title('x[n]偶部序列');
subplot(3,1,3);     stem(n,od);
xlabel('n');ylabel('xod[n]');    title('x[n]奇部序列');

⑦ 计算 x[n] 和 h[n] 的线性卷积y[n]

        线性时不变离散系统,输出序列是输入序列和冲激响应(单位脉冲响应) 的线性卷积。

 

clear ; clc; close all;
n = 0 : 14;     
x = (-1).^n;
m = 0 : 7;      
h = cos(0.25 * pi * m); 
y = conv(h,x)
n = 0:21;
stem(n,y);
xlabel('n');
ylabel('y[n]');
title('Output Obtained by Linear Convolution'); 
grid;

 ⑧ 在正弦波形叠加后范围内的连续波形

clear ; clc; close all;
t = 0 : 10^(-6) : 6*10^(-3);
xa = cos(5000*pi*t) + 4*sin(2000*pi*t).*sin(3000*pi*t);
plot(t,xa);grid
xlabel('Time, sec');
ylabel('Amplitude');
title('Continuous-time signal x_{a}(t)');

  • 1
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

90后嫩男

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值