数字图像处理作业(2)

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

(a) Load the signal by the command “load TestSig”. You will find two variables t and y. t is the time label with the unit “s”, and y is the corresponding amplitude of the signal. Use plot() command to plot the signal, and show the x (time) and y (amplitude) labels. Tell what the sampling frequency is. Answer:

The code of the program is: >> load TestSig; >> plot(t,y); >> xlabel('time'); >> ylabel('amplitude');

The sampling frequency is 1/0.005s=200Hz

0.5

1

1.52

2.5

3

-1-0.8-0.6-0.4-0.200.20.40.60.8

1time

a m p l i t u d e

(b) Use the time-domain method to analyze how many frequency components contained in the signal, and what these frequencies are. Answer:

由图时域图可知,三秒内分别是三个不同频率的信号:第一秒内信号经历5个周期,所以频率为5Hz;第二秒内信号经历10个周期,所以频率为10;第三秒内,信号经历15个周期,所以频率为15。综上可知:信号包含3个频率分量,分别是5Hz,10Hz,15Hz。

(c) Use the frequency-domain method to analyze how many frequency components contained in the signal, and what these frequencies are. Please use fft() command to calculate the spectrum. Use plot() command to plot the spectrum, and show the x (frequency) and y (amplitude) labels. (Review the role of sampling frequency)

Answer:

The code of the program is:

>> load TestSig;

>>Fs=200;

>>L=length(y);

>>NFFT = 2^nextpow2(L);

>>Y = fft(y,NFFT)/L;

>>f = Fs/2*linspace(0,1,NFFT/2+1);

>>plot(f,2*abs(Y(1:NFFT/2+1)));

>>title('Single-Sided Amplitude Spectrum of y(t)');

>>xlabel('Frequency (Hz)'); >>ylabel('|Y(f)|');

由图可知,信号包含3个频率分量,频率分别为:5Hz ,10Hz ,15Hz 。 (d) Use the wavelet method to analyze the signal. Figure out how many frequency components contained in the signal, and what these frequencies are. Please use wavedec() command to perform the digital wavelet transform. Use plot() command to plot the wavelet coefficients (detailed and approximate). Answer :

The code of program is as follows: >> load TestSig

>> [coefs,sgram] = cwt(y,[1:32],'haar','scal');

0102030

405060708090100

0.05

0.1

0.15

0.20.25

0.3

0.35

Single-Sided Amplitude Spectrum of y(t)

Frequency (Hz)

|Y (f )|

Plot_3D=cwt(y,[1:32],'haar','3Dplot');

100

200

300

400

500

600

-1

1Analyzed Signal

Scalogram

Percentage of energy for each wavelet coefficient

Time (or Space) b

S c a l e s a

100200

300400

500600

1 3 5

7 911131517192123252729310.005

0.010.0150.020.0250.030.0350.04

可以看出有三个频率分量。 [C,L] = wavedec(y,3,'haar'); A=appcoef(C,L,’haar’); time_a3=[0:0.4:3]; plot(time_a3,A);

傅里叶分析: Fs=25; LG=76;

NFFT = 2^nextpow2(LG); Y = fft(A,NFFT)/LG;

f = Fs/2*linspace(0,1,NFFT/2+1); plot(f,2*abs(Y(1:NF ·FT/2+1)));

00.51

1.52

2.53

-3

-2

-1

12

3

time

a m p l i t u d e

相关文档
最新文档