Exercise I BME0303 3031511093 田汇宝 Question i: In general, arbitrary signal can be represented by Fourier series。 Is it also the case for biomedical signal? Try to simulate ECG signal by Fourier series。 Solution i: When I saw the question,I was lost a long time。In my original opinion,I want to use an expression to simulate the ECG signal。But in the processing of the working,I find that it is very difficult to write the expression in mode of series of the cosine or sin function。 I ‘m puzzled to make sure that the coefficient is what exactly。 In the equation of the following, we can’t ensure the exact parameter what Ak & k 。 At last, I decide to use Fourier series graphic to express the ECG signal。 Equation is x(t ) N A cos(w t k k k ) 。x(t) is an arbitrary signal, Ak is k 1 the coefficient, wk is the Fourier parameter, k is the phase offset。 In Matlab software, I find a function that can generate an ECG signal(just in version 7。0。 1 or higher version), so I write a m_file as following: ECG=ecg(1000)。'; Yf15=sgolayfilt(ECG,0,15); Y=fft(Yf15,512); modY=abs(Y); t=1:512; plot(t,modY); %SGOLAYFILT smoothes the signal X using a Savitzky-Golay (polynomial) smoothing filter。 I just get a period signal, we should deal with a series signal of having different periods。 Because an arbitrary signal is not a periodic signal。 , I mean the period of every signal is not equal。 The result shows us the arbitrary signals have great randomicity。 The ECG signal is sequential, the length of every R-R interval is not equal。 To this question, I just generate a random ECG signal, next time, I can generate another one。 (The picture is following in next page) Question ii: How to generate a random variable? value M and standard deviation ? Try to create a Gaussian random variable with expected Solution ii: In matlab software ,I find a function that can generate Gauss function。The Gauss function is showed by the average M and the standard deviation 。We program a function named read(EV,SD) to input the expected value M and standard deviation 。The read() function just is allowed by keyboard。The code is following: R=NORMRND(M,Sigma); R=M+sqrt(o)*randn(M,N); %NORMRND Random arrays from the normal distribution。 R = NORMRND(MU,SIGMA) returns an array of random numbers chosen from a normal distribution with mean MU and standard deviation SIGMA。 arrays。 The size of R is the common size of MU and SIGMA if both are If either parameter is a scalar, the size of R is the size of the other parameter。 I give you an example to testify our answer: I define M=15 and the Sigma=0.05,the row number is 5,the line number is 1, so the result is following: NO. 1 2 3 4 5 Value 15.0017 14.9185 15.0156 14.9661 14.9899 We can distinguish the above table from the below one in their datas: NO. 1 2 3 4 5 Value 14.6886 14.7092 14.8647 14.6671 15.1249 Question iii: There is a series of RR interval extracted from ECG。 The data are stored in file RR。txt。 Try to compute and illustrate the power spectrum of RR interval。 Solution iii: In matlab software, we import the data by the file menu import date submenu。 I get a vector with row number 193 and the column number 1; With the function of load, I import the R-R interval value in the txt file。 The R-R interval is not equal, the function is not a periodic function and so we must illustrate the continual function in order to simulate the spectrum of the R-R interval。 From the discrete to continual, I use the interpose value way to complete it。 The way of interpolation interp1 is showed in the m_file。 The m_file is following (N is share that you can define yourself 。) RR=load('RR。TXT'); var=0; for i=1:193 var=var+RR(i); xRR(i)=var; end yRR=RR; xRRi=0:(xRR(193)。/N):xRR(193); yRRi=interp1(xRR,yRR,xRRi); plot(xRR,yRR,xRRi,yRRi,'b*'); %stem(xRR,yRR,'ro',xRRi,yRRi,'b*'); %YI = INTERP1(X,Y,XI) interpolates to find YI, the values of the underlying function Y at the points in the array XI。 X must be a vector of length N。% After interp value, we can get the yRRi value。I plot the picture of the yRRi spectrum: Then I will show you two pictures with different N number。 And then I show you the spectrum of the signal R-R internal。 I use two ways to do this job。 The definition way and the matlab existed function way, the pictures for the ways are following: