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

📄 gghconv.m

📁 the code of the book come form the book of marlix laboratory with the book of singal
💻 M
字号:
function [x,n]=gghconv(x1,x2,n1,n2)  
% 计算离散序列卷积和实用函数
x=conv(x1,x2) 				    	%计算序列x1与x2的卷积和并赋值给向量x
ns=n1(1)+n2(1);						%计算序列卷积和序列x非零样值的起点位置
leg=length(x1)+length(x2)-2;		%计算卷积和序列x非零样值的时域宽度
n=ns:(ns+leg)                         %求出卷积和序列x非零样值的时间序号向量
subplot(2,2,1)
stem(n1,x1, 'filled')                %在子图1绘制序列x1(n)时域波形
title('x1(n) ')
xlabel('n')
subplot(2,2,2)
stem(n2,x2, 'filled')                %在子图2绘制序列x2(n)时域波形
title('x2(n) ')
xlabel('n')
subplot(2,2,3)
stem(n,x, 'filled')                    %在子图3绘制卷积和序列x(n)时域波形
title('x(n)=x1(n)*x2(n) ')
xlabel('n')
p=get(gca, 'position');				   %获取当前坐标轴对象位置
p(3)=2.4*p(3);                         
set(gca, 'position',p)			%将子图3的横坐标范围扩为原来的2.4倍

⌨️ 快捷键说明

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