东南大学Matlab课程Matlab+homework+3 下载本文

内容发布更新时间 : 2024/7/3 11:33:44星期一 下面是文章的全部内容请认真阅读。

Matlab Worksheet 3

Part A

1. Using function conv_m.m to make convolution between the following to functions (x and h):

x=[3, 11, 7, 0, -1, 7, -5, 0, 2]; h=[11, 9, 0, -7, -3, 2, 0 -1]; nx=[-2:6]; nh=[0:7];

Plot the functions and convolution results.

2. Plot the frequency response over 0????for the following transfer function by letting

z?ej?, where ?is the frequency (rad/sample)., with appropriate labels and title.

zH(z)?2 .

z?1.6z?0.9

3. Use fft to analyse following signal by plotting the original signal and its spectrum.

n?n?n????x[n]?sin?2?32??sin?2?137??sin?2?467?.

102410241024??????

4. Use the fast Fourier transform function fft to analyse following signal. Plot the original signal, and the magnitude of its spectrum linearly and logarithmically. Apply Hamming window to reduce the leakage.

n?n?n????x[n]?sin?2?32.5?sin2?137.4?sin2?467.7?????.

1024?1024?1024????

The hamming window can be coded in Matlab as

for n=1:N

hamming(n)=0.54+0.46*cos((2*n-N+1)*pi/N); end;

where N is the data length in the FFT.

1

Part B

Simulation Using SIMULINK

INTRODUCTION

The objective of this laboratory is to learn about various properties of signals and systems by doing simulations in SIMULINK.

PART 1. BASICS OF SIMULINK

1.1 UNDERSTANDING SIMPLE WAVEFORMS AND INTEGRATION

Create a pulse of height 2 units from time 0 to 4 seconds by subtracting two unit steps and adding a gain. Connect this pulse to an integrator with a gain of 0.5 and a zero initial condition. Connect oscilloscopes to show the pulse and the output of the integrator. You may wish to name your simulation (block) diagram; to do so use the save as feature under edit. Your block diagram should be similar as below.

Before simulating you need to pull down the simulation header and double click on parameters. Unless told otherwise always assume that you can use the ode 45 integration algorithm shown in this window and the other default parameters. Typically you will only alter the start and stop times but for this first simulation you can use the default values of 0 and 10 seconds. Double click on the oscilloscopes to get the windows in which the traces will appear, pull down the simulate menu and click on run. Plot below the integrator input and output waveforms. Repeat the experiment but with an initial condition of –2 on the integrator. Again draw the results.

2

1.2 FIRST ORDER SYSTEM

A single time constant may be simulated using the transfer function block in which you enter the coefficients of the numerator and denominator polynomials. Set up the configuration in a new SIMULINK window to realise the transfer function 1/(s+2) with the input unit step and an oscilloscope connected to the output of the transfer function block. Plot the block diagram in the space below. Simulate the system for 5 seconds and plot the response.

1.3 SECOND ORDER SYSTEM

22For the second order all pole transfer function ?0/(s2?2?s?0??0)you will recall that if a time scale of ω0t is used for plotting the step response, the response shape will only be affected by changes in the damping ratio ζ. This can also be shown if we normalise the transfer function by replacing (s/ω0) by sn to

2give 1/(sn?2?sn?1). To study the effect of varying ζ on the step response we will therefore use the transfer function 1/(s2+2ζs+1). Set up the following configuration for a simulation study.

3