最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 正文

信号与系统——MATLAB基本实验

来源:动视网 责编:小OO 时间:2025-09-26 18:01:32
文档

信号与系统——MATLAB基本实验

《信号与系统MATLAB实践》第一次上机作业实验一、熟悉MATLAB基本操作三、基本序列运算1.数组的加减乘除和乘方运算A=[123];B=[456];C=A+B;D=A-B;E=A.*B;F=A./B;G=A.^B;subplot(2,4,1);stem(A)subplot(2,4,2);stem(B)subplot(2,4,3);stem(C)subplot(2,4,4);stem(D)subplot(2,4,5);stem(E)subplot(2,4,6);stem(F)subplot(
推荐度:
导读《信号与系统MATLAB实践》第一次上机作业实验一、熟悉MATLAB基本操作三、基本序列运算1.数组的加减乘除和乘方运算A=[123];B=[456];C=A+B;D=A-B;E=A.*B;F=A./B;G=A.^B;subplot(2,4,1);stem(A)subplot(2,4,2);stem(B)subplot(2,4,3);stem(C)subplot(2,4,4);stem(D)subplot(2,4,5);stem(E)subplot(2,4,6);stem(F)subplot(
《信号与系统MATLAB实践》第一次上机作业

实验一、熟悉MATLAB基本操作

三、基本序列运算

1.数组的加减乘除和乘方运算

A=[1 2 3];

B=[4 5 6];

C=A+B;

D=A-B;

E=A.*B;

F=A./B;

G=A.^B;

subplot(2,4,1);stem(A)

subplot(2,4,2);stem(B)

subplot(2,4,3);stem(C)

subplot(2,4,4);stem(D)

subplot(2,4,5);stem(E)

subplot(2,4,6);stem(F)

subplot(2,4,7);stem(G)

2.绘制函数波形

(1)t=0:0.001:10

x=3-exp(-t);

plot(t,x)

ylabel('f(t)');

xlabel('t');

title('(1)');

(2)t=0:0.001:10

x=5*exp(-t)+3*exp(-2*t);

plot(t,x)

ylabel('f(t)');

xlabel('t');

title('(2)');

(3)t=0:0.001:3

x=exp(-t).*sin(2*pi*t);

plot(t,x)

ylabel('f(t)');

xlabel('t');

title('(3)');

(4)t=0:0.001:3

x=sin(3*t)./(3*t);

plot(t,x)

ylabel('f(t)');

xlabel('t');

title('(4)');

(5)k=1:1:6

x=(-2).^(-k);

stem(k)

xlabel('k');

ylabel('f(k)');

title('(5)');

(6)k=0:1:4

x=exp(k);

stem(k)

xlabel('k');

ylabel('f(k)');

title('(6)');

(7)k=1:1:99

x=k;

stem(k)

xlabel('k');

ylabel('f(k)');

title('(7)');

四、利用MATLAB求解线性方程组。

1. a=[2 3 1;1 1 1;3 -1 -1];

b=[11 6 -2]';

x=inv(a)*b

x =

2. a=[1 1 1;1 -2 1;1 2 3];

b=[2 -1 -1]';

x=inv(a)*b

x =

3. a=[1 1 0;0 1 1;1 0 1];

b=[27 33 30]';

x=inv(a)*b

x =

实验二、信号的运算

二、编写实现下列离散信号运算函数的程序,并画出波形。

1. k=0:100

x=sin(k);

stem(x)

xlabel('k');

ylabel('f(k)');

title('2');

2. k=0:100

x=sin(k)+sin(pi*k);

stem(x)

xlabel('k');

ylabel('f(k)');

title('2');

3. k=3:103

x=k.*sin(k);

stem(x)

xlabel('k');

ylabel('f(k)');

title('3');

4. function f=fun(k)

for i=1:100

end

stem(k,f)

xlabel('k');

ylabel('f(k)');

title('4');

七、编写一个计算两个离散序列的卷积和的程序,并用其计算下列卷积的和。

1. f1=[1 1 1 1];

f2=[1 0.5 0.25 0.125 0.0625];

conv(f1,f2)

ans =

    1.0000    1.5000    1.7500    1.8750    0.9375    0.4375    0.1875    0.0625

2. f1=[1 1 1 1];

f2=[3 2 1];

conv(f1,f2)

ans =

     3     5     6     6     3     1

实验三、信号的谱分析

二、1. clc;

clear all;

x=[1,2,3,4,5,6,6,5,4,3,2,1];

dtft=zeros(70);

for i=1:70

end

subplot(1,2,1);

plot(w,abs(dtft));xlabel('w');ylabel('DTFT');title('幅频特性');

subplot(1,2,2);

plot(w,angle(dtft));xlabel('w');ylabel('DTFT');title('相频特性');

    

2. clc;

clear all;

for i=1:120

  %  x=[1,2,3,4,5,6,6,5,4,3,2,1];

%dtft=zeros(150);

for i=1:120

end

G=fft(x);

subplot(1,2,1);

plot(w(1:80),abs(G(1:80)));xlabel('w');ylabel('DFT');title('幅频特性');

subplot(1,2,2);

plot(w(1:80),angle(G(1:80)));xlabel('w');ylabel('DFT');title('相频特性');

3. %DTFT

clc;

clear all;

x=[1,2,3,4,5,6,6,5,4,3,2,1];

dtft=zeros(70);

for i=1:70

end

figure;plot(w,abs(dtft),'b');xlabel('w');ylabel('DTFT or DFT');title('幅频特性');

hold on

 

%DFT

clc;

clear all;

for i=1:120

end

 

for i=1:120

end

G=fft(x);

hold on;

plot(w(1:80),abs(G(1:80)),'r');xlabel('w');ylabel('DTFT or DFT');title('幅频特性');

三、分别用数值计算法和DFT法,计算下列信号的频谱,并画出其幅度频谱和相位频谱。

1.数值计算

 %fun111.m

function y=fun111(t)

[M,N]=size(t);

for i=1:N

if((t(i)>-pi)&&(t(i)<0))

elseif ((t(i)>0)&&(t(i)else

end

end

%new111.m

clear all

clc

for i=1:1000

 0,1);

end

subplot(1,2,1);

plot(w,abs(G));xlabel('w');ylabel('G');title('数值计算幅度频谱');

subplot(1,2,2);

plot(w,angle(G));xlabel('w');ylabel('Fi');title('数值计算相位频谱');

DFT法

%fun1.m

function y=fun1(x)

if((-pielseif ((0else

end

%new.m

clear all

clc

for i=1:1000

end

for i=1001:10000

end

G=fft(g)/1000;

subplot(1,2,1);

plot(w(1:50),abs(G(1:50)));

xlabel('w');ylabel('G');title('DFT幅度频谱');

subplot(1,2,2);

plot(w(1:50),angle(G(1:50)))

xlabel('w');ylabel('Fi');title('DFT相位频谱');

2.数值计算

%fun222.m

function y=fun222(t)

[M,N]=size(t);

for i=1:N

if (t(i)<1) && (t(i)>-1)

else

end

end

%new222.m

clear all

clc

for i=1:1000

 0,1);

end

subplot(1,2,1);

plot(w,abs(G));xlabel('w');ylabel('G');title('数值计算幅度频谱');

subplot(1,2,2);

plot(w,angle(G));xlabel('w');ylabel('Fi');title('数值计算相位频谱');

DFT法

%fun2.m

function y=fun2(x)

if x<1 && x>-1

else

end

%new2.m

for i=1:1000

 2(2/1000*i-1);

end

for i=1001:10000

end

G=fft(g)/1000;

subplot(1,2,1);

plot(w(1:50),abs(G(1:50)));

xlabel('w');ylabel('G');title('幅度频谱');

subplot(1,2,2);

plot(w(1:50),angle(G(1:50)))

xlabel('w');ylabel('Fi');title('相位频谱');

3.数值计算

%fun333.m

function y=fun333(t)

[M,N]=size(t);

for i=1:N

if (t(i)<0) && (t(i)>-1)

elseif t(i)>0 && t(i)<1

else

end

end

end

%new333.m

clear all

clc

for i=1:1000

end

subplot(1,2,1);

plot(w,abs(G));xlabel('w');ylabel('G');title('数值计算幅度频谱');

subplot(1,2,2);

plot(w,angle(G));xlabel('w');ylabel('Fi');title('数值计算相位频谱');

DFT法

%fun3.m

function y=fun3(x)

if x<0 && x>-1

elseif x>0 && x<1

else

end

%new.m

for i=1:1000

 3(2/1000*i-1);

end

for i=1001:10000

end

G=fft(g)/1000;

subplot(1,2,1);

plot(w(1:50),abs(G(1:50)));

xlabel('w');ylabel('G');title('DFT幅度频谱');

subplot(1,2,2);

plot(w(1:50),angle(G(1:50)))

xlabel('w');ylabel('Fi');title('DFT相位频谱');

文档

信号与系统——MATLAB基本实验

《信号与系统MATLAB实践》第一次上机作业实验一、熟悉MATLAB基本操作三、基本序列运算1.数组的加减乘除和乘方运算A=[123];B=[456];C=A+B;D=A-B;E=A.*B;F=A./B;G=A.^B;subplot(2,4,1);stem(A)subplot(2,4,2);stem(B)subplot(2,4,3);stem(C)subplot(2,4,4);stem(D)subplot(2,4,5);stem(E)subplot(2,4,6);stem(F)subplot(
推荐度:
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top