- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
信号与系统Matlab作业一.doc
信號與系統Matlab作業一
Matlab程式碼如下:
% 電機三 張毓麟
% (a) 做出x1, x2, x3, x4然後畫圖, 用subplot和hold各畫一遍
clear all
clc
close all
% -20=n=100
n=-20:100;
% define the functions
x1=exp(j*(pi/4)*n);
x2=sin(pi*n/8+pi*n/16);
x3=(9/10).^n;
x4=n+1;
% 開始畫圖
% 以下是用Subplot的
% X1實部
subplot(2,3,1)
stem(n, real(x1),b);
axis([-20,100,-1,1]);
title(x1 Real Part);
% X1 Image Part
subplot(2,3,2);
stem(n, imag(x1), b);
axis([-20,100,-1,1]);
title(x1 Image Part);
% X2
subplot(2,3,3);
stem(n, x2, b);
axis([-20,100,-1,1]);
title (x2);
% X3
subplot(2,3,4);
stem(n, x3, b);
axis([-20,100,0,10]);
title (x3);
% X4
subplot(2,3,5);
stem(n, x4, b);
axis([-20,100,-50,150]);
title (x4);
-----------------------------------------------------------------------------------------------------------------------------------------------------------
所得圖形如下頁
然後接下來是使用hold放在同一張圖上,之後的想用hold都可以用這個改,所以不贅印
% 使用single figure, hold繪製圖形
clc
hold on
stem(n, real(x1), y); %Yellow
stem(n, imag(x1), k); %Black
stem(n, x2, b); %Blue
stem(n, x3, g); %Green
stem(n, x4, r); %Red
title (Using hold to combine these vectors in a single figure);
legend(x1 Real part, ,x1 Image Part, ,x2, ,x3, ,x4, );
(b)
% (b)使用filter
B=[1 0.9];
A=[1 -0.25];
y1=filter(B,A,x1);
y2=filter(B,A,x2);
y3=filter(B,A,x3);
y4=filter(B,A,x4);
% 開始畫圖
subplot(2,3,1);
stem(n, real(y1));
title(y1 Real Part);
axis([0 100 -3 3]);
subplot(2,3,2);
stem(n, imag(y1));
title(y1 Image Part);
axis([0 100 -3 3]);
subplot(2,3,3);
stem(n, y2);
title(y2);
axis([0 100 -3 3]);
subplot(2,3,4);
stem(n, y3);
title(y3);
axis([0 100 0 5]);
subplot(2,3,5);
stem(n, y4);
title(y4);
axis([0 100 0 300]);
本題的使用filter即可解決
比較input和output,可得到為eigenfunction
(c)
% (c)eigenvalue
H1=y1./x1;
H2=y2./x2;
H3=y3./x3;
H4=y4./x4;
% 將圖繪出
subplot(2,3,1);
stem(n, real(H1));
title(H1 Real Part);
axis([0 100 0 2]);
subplot(2,3,2);
stem(n, imag(H1));
title(H1 Image Part);
axis([0 100 -1.4 0]);
subplot(2,3,3);
stem(n, H2);
title(H2);
axis([0 100 -3 3]);
subplot(2,3,4);
stem(n, H3);
title(H3);
axis([0 100 0 3])
文档评论(0)