- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
MATLAB一些函数实例
1.三角波产生器
t -3:0.01:3;
f1 tripuls(t);
subplot(3,1,1);
plot(t,f1);
axis([-3,3,-0.2,1.2])
set(gcf,color,w);
f2 tripuls(t,4);
subplot(3,1,2);
plot(t,f2);
axis([-3,3,-0.2,1.2])
%set(gcf,color,w);
f3 tripuls(t,4,-1);
subplot(3,1,3);
plot(t,f3);
axis([-3,3,-0.2,1.2])
2.离散序列的相加与相乘
function [x,n] jxl (x1,x2,n1,n2)
n min (min (n1),min (n2)):max (max (n1),max (n2));
s1 zeros(1,length (n));s2 s1;
s1(find ((n min (n1))(n max (n1)) 1)) x1;
s2 (find ((n min (n2))(n max (n2)) 1)) x2;
x s1+s2;//x s1.*s2:%序列乘
axis([(min (min (n1),min (n2))-1),(max (max (n1),max (n2))+1),(min (x)-0.5),
(max (x)+0.5)])
3.序列的反摺
function [x,n] xlfz(x1,n1)
x fliplr (x1);n fliplr (n1);
stem (n,x,filled)
axis([min (n)-1,max (n)+1,min (x)-0.5,max (x)+0.5])
4.序列的卷积
function [x,n] gghconv (x1,x2,n1,n2)
x conv (x1,x2)
ns n1(1)+n2 (1);
leg length (x1)+length (x2)-2;
n ns:(ns+leg)
subplot (2,2,1)
stem (n1,x1,filled)
title (x1(n))
xlabel (n)
subplot (2,2,2)
stem (n2,x2,filled)
title (x2 (n))
xlabel (n)
subplot (2,2,3)
stem (n,x,filled)
title (x (n) n1(n)+x2 (n))
xlabel (n)
p get (gca,position);
p (3) 2.4*p (3);
set (gca,position,p)
5.l 连续函数的卷积
function [f,t] gggfconv (f1,f2,t1,t2)
d input (ÇëÊäÈë²ÉÑù¼ä¸ôd:);
f conv (f1,f2)
f f*d;
ts t1(1)+t2 (1);
l length (f1)+length (f2)-2;
t ts:d:(ts+l*d);
subplot (2,2,1)
plot (t1,f1)
axis([min (t1),max (t1),min (f1)-min (f1)*0.2,max (f1)+max (f1)*0.2])
title (f1(t))
xlabel (t)
subplot (2,2,2)
plot (t2,f2)
axis([min (t2),max (t2),min (f2)-min (f2)*0.2,max (f2)+max (f2)*0.2])
title (f2 (t))
xlabel (t)
subplot (2,2,3)
plot (t,f)
axis([min (t),max (t),min (f)-min (f)*0.2,max (f)+max (f)*0.2])
p get (gca,position);
p (3) 2.4*p (3);
set (gca,position,p)
title (f(t) f1(t)*f2 (t))
xlabel (t)
6.周期信号傅里叶级数
display (傅里叶展开的项数)
m input (m );
t -2*pi:0.01:2*pi;
n round (length (t)/4);
f [ones(n,1);-1*ones(n,1);ones(n,1);-1*ones(n+1,1)];
ones(314,1);
y zeros(m+1,max (size (t)));
figure (1);
y (m+1,:) f;
文档评论(0)