matlab實驗一訊號的產生和時間變數的變換

2022-12-10 10:42:05 字數 5056 閱讀 8023

訊號與系統分析

實驗報告

實驗名稱訊號的產生及時間變數的變換

實驗型別驗證

班級資訊10-1

學號 201016050133

姓名翟彥河

實驗日期 2012-4-10

1,產生並畫出下列訊號:

a,單位衝擊訊號δ(t)與單位脈衝序列δ(n);

b,單位階躍訊號μ(t)與單位階躍序列μ(n);

(a)%impulse squence

subplot(1,2,1);

n=[-10:10];

z=(n==0);

stem(n,z);

title('ò');

xlabel('n');

ylabel('\delta[n]');

%impulse function

subplot(1,2,2);

t=-10:0.1:10;

y=(t==0);

plot(t,y,'r');

title('¤');

xlabel('t');

ylabel('\delta[t]');

(b)%step squence

subplot(1,2,1);

n=[-10:10];

z=(n>=0);

stem(n,z);

title('×ò');

xlabel('n');

ylabel('\u[n]');

%step function

subplot(1,2,2);

t=-10:0.1:10;

y=(t>=0);

plot(t,y,'b');

title('×');

xlabel('t');

ylabel('\u[t]');

2 產生並畫出下列訊號:

a,在【-2π,2π】的範圍內,畫出正弦訊號sin(t);

b,利用sawstooth函式,在【-5π,5π】的範圍內,畫出週期三角波和鋸齒波。

c,利用square函式,在【-5π,5π】的範圍內,畫出週期方波。

(a)%since w**e

t=-2*pi:pi/20:2*pi;

plot(t,sin(t));

title('');

xlabel('t');

ylabel('sin(t)');

(b)%triangular w**e

subplot(1,2,1);

t=-5*pi:pi/100:5*pi;

x=sawtooth(t,0.5);%sawtootnmatlab

plot(t,x);

title('¨');

xlabel('t');

ylabel('x');

%sawtooth w**e

subplot(1,2,2);

z=sawtooth(t);%±íz×ó2pi×±

plot(t,z);

title('¨');

xlabel('t');

ylabel('z');

(c)%square w**e

t=-5*pi:pi/100:5*pi;

x=square(t);%squarematlab

plot(t,x);

axis([-5*pi,5*pi,-1.5,1.5]);

title('·¨');

xlabel('t');

ylabel('x');

3 在[-4π,4π]的範圍內,產生sinc函式曲線與diric函式曲線(結數n=5)

sinc函式的定義sinc(t)=[sin(πt)]/ πt;

diric的函式定義為diric=(sin(nt/2))/(nsin(t/2))

figure(1);clf;%¨1°±°°

t=-4*pi:pi/20:4*pi;

%sinc function

subplot(2,1,1);

plot(t,sinc(t));%sincmatlab

title('sinc function ');

grid;

xlabel('t');

ylabel('sinc(t)');

%diric function

subplot(2,1,2);

plot(t,diric(t,5));%diricmatlab

title('diric function');

grid;

xlabel('t');

ylabel('diric(t)');

4 在n=[-10,10 ]的範圍內產生離散訊號:

n=[-10:10];

x=2*n.*(n<=3&n>=-3);

stem(n,x);

title('');

xlabel('n');

ylabel('x[n]');

5.在n=[-10:10]的範圍內畫出一下的訊號:

clear;clc;clf

n=[-10:10];

x1=delta(n);

x2=delta(n+2);

x3=delta(n-4);

x4=2*delta(n+2)-delta(n-4);

subplot(2,2,1);stem(n,x1);

title('x_1[n]=\delta[n]');axis([-10,10,-1,2]);grid on;

subplot(2,2,2);stem(n,x2);

title('x_2[n]=\delta[n+2]');axis([-10,10,-1,2]);grid on;

subplot(2,2,3);stem(n,x3);

title('x_3[n]=\delta[n-4]');axis([-10,10,-1,2]);grid on;

subplot(2,2,4);stem(n,x4);

title('x_4[n]=2*\delta[n+2]-\delta[n-4]');axis([-10,10,-1,2]);grid on;

6. 產生復訊號:

並畫出他們的實部和虛部及模值和相角。

(a)n=[0:32];

x=exp(j*(pi/8)*n);

subplot(2,2,1);stem(n,real(x));title('real part');xlabel('n');

subplot(2,2,2);stem(n,imag(x));title('imaginary part');xlabel('n');

subplot(2,2,3);stem(n,abs(x));title('magnitude');xlabel('n');

subplot(2,2,4);stem(n,(180/pi)*angle(x));

title('phase(\circ) part');xlabel('n');

%angle(x)in rad unit;(180/pi)*angle(x)in degree unit

(b)n=[-10:10];

x=exp((-0.1+j*0.3)*n);

subplot(2,2,1);stem(n,real(x));title('real part');xlabel('n');

subplot(2,2,2);stem(n,imag(x));title('imaginary part');xlabel('n');

subplot(2,2,3);stem(n,abs(x));title('magnitude');xlabel('n');

subplot(2,2,4);stem(n,(180/pi)*angle(x));

title('phase(\circ) part');xlabel('n');

7.已知x[n]=u[n]-u[n-10],要求將它們進行奇偶分量分解,分解為奇分量

的源程式如下:

function [x,n]=stepseq(n0,n1,n2);

if nargin ~=3

disp('usage:y=stepseq(n0,n1,n2)');

elseif((n0n2)|(n1>n2))

error('arguments must satisfy n1<=n0<=2')

endn=[n1:n2];

x=[(n-n0)>=0];

的源程式如下:

function [xe,xo,m]=evenodd(x,n)

if any (imag(x)~=0)

error('x is not a real sequence');

return;

endm=-fliplr(n);

m1=min([m,n]);m2=max([m,n]);m=m1:m2;

nm=n(1)-m(1);n1=1:length(n);

x1=zeros(1,length(m));

x1(n1+nm)=x;x=x1;

xe=0.5*(x+fliplr(x));

xo=0.5*(x-fliplr(x));

源程式如下:

>> n=[0:10];

>> x=stepseq(0,0,10)-stepseq(10,0,10);

>> [xe,xo,m]=evenodd(x,n);

>> subplot(2,2,1);stem(n,x);title('step sequence');

>> xlabel('n');ylabel('x[n]');axis([-10 10 -1.2 1.2]);

>> subplot(2,2,3);stem(m,xe);title('even part');

>> xlabel('n');ylabel('xe[n]');axis([-10 10 -1.2 1.2]);

>> subplot(2,2,4);stem(m,xo);title('odd part');

>> xlabel('n');ylabel('xo[n]');axis([-10 10 -1.2 1.2]);

8.已知序列

a.畫出x[n];

.x=zeros(1,21);y1=zeros(1,21);y2=zeros(1,21);y3=zeros(1,21);

實驗一Matlab軟體的使用

1 實驗目的和要求 掌握matlab軟體的使用方法 常用離散時間訊號的產生 顯示和運算。2 實驗內容 matlab軟體常用命令和工具箱的使用,學會簡單的程式設計 程式設計實現常用離散時間訊號 離散時間訊號的疊加 移位 線性卷積等基本運算。3 實驗原理 利用軟體生成數字訊號處理系統中所涉及的訊號及訊號...

實驗一Matlab使用方法和基本程式設計

一 實驗要求 1 掌握matlab軟體使用的基本方法 2 掌握matlab的基本操作 3 熟悉matlab的資料表示 基本運算和程式控制語句 4 熟悉matlab程式設計的基本方法及除錯 5 熟悉matlab繪圖命令及基本繪圖控制。二 實驗內容 1 幫助命令 使用help命令,查詢 sqrt 開方 ...

通原實驗報告 基帶訊號和頻帶訊號的頻譜測試

實驗報告 姓名學號班級 通訊0901班 第十五周星期一第二大節 下午 實驗名稱 基帶訊號和頻帶訊號的頻譜測試 一 實驗目的 1 加深對各種基帶數碼訊號頻譜的理解。2 加深對各種數字基帶訊號頻譜頻寬的理解。3 掌握虛擬儀器測試各種數字基帶訊號頻譜和頻寬的方法。4 加深對各種數字已調訊號頻譜的理解。5 ...