单位样本序列
clc
clear
close all
n1 = 0;
n2 = 5;
n0 = 3;
n = [n1:n2];
x = [(n - n0) == 0];
stem(n,x,'filled');
ylim([-1,2]);
改成一个函数:
function [x,n]=delta(n0,n1,n2);
% generate x(n) = delta(n - n0); n1 <= n <= n2
%_____________________________________________
%[x,n] = delta(n0, n1, n2);
%
n = [n1:n2];
x = [(n-n0) == 0];
命名为delta.m
新建一个脚本:
n0 = 3;
n1 = -3;
n2 = 6;
[x,n] = delta(n0,n1,n2);
stem(n,x,'filled');
ylim([-1,2]);
运行得到:
单位阶跃序列
直接写成函数形式吧:
function [x,n]=stepseq(n0,n1,n2);
% generate x(n) = u(n - n0); n1 <= n <= n2
%_____________________________________________
%[x,n] = stepseq(n0, n1, n2);
%
n = [n1:n2];
x = [(n-n0) >= 0];
新建一个脚本,测试:
clc
clear
close all
n0 = 3;
n1 = -3;
n2 = 6;
[x,n] = stepseq(n0,n1,n2);
stem(n,x,'filled');
ylim([-1,2]);
结果:
实值指数序列
为一般形式。
下面产生一个序列:
脚本代码:
clc
clear
close all
n = -3:10;
x = 0.9.^n;
stem(n,x,'filled');
xlabel('n');
ylabel('0.9^n');
xlim([-5,13]);
ylim([0,2]);
复指数序列
clc
clear
close all
n = 0:10;
x = exp( (2+3j)*n );
stem(n,x);
xlabel('n');
周期序列
clc
clear
close all
n = 0:10;
x = exp( (2+3j)*n );
subplot(2,1,1)
stem(n,x);
xlabel('n');
title('Not Period Sequence');
% the number of period
P = 5;
xtilde = x' * ones(1,P);
xtilde = xtilde(:)';
subplot(2,1,2);
stem(xtilde);
title('Period Sequence');
本文同步分享在 博客“李锐博恩”(CSDN)。
如有侵权,请联系 support@oschina.cn 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一起分享。