# 1 write a function that will create a sine wave with multiple frequencies about 5 or 5346967

1. Write a function that will create a sine wave with multiple frequencies (about 5 or so) ranging

between 500 Hz to 10 KHz. The output should be a superposition (that is, addition) of the multiple

sine waves.

Low Pass Filter (LPF):

Write a function to design a 2nd order Low Pass Filter such that frequencies beyond 3000 Hz are

suppressed.

High Pass Filter (HPF):

Write a function to design a 2nd order High Pass Filter such that frequencies below 3000 Hz are

suppressed.

Plotting:

Now, write a function which will plot the first 200 points of the original sine wave, the first 200

points of the resulting low-pass filtered sine wave and the first 100 points of the resulting high-pass

filtered sine wave.

Hints:

%uF0B7 To create a sine wave, use the formula, y = sin (2*pi*f*t), where f is the sampling frequency

at 20 KHz (or, you can choose a value between 10 KHz and 25 KHz) and t lies between 0 and

0.5, increasing in steps of 1/f. For more information on how to create a sine wave, you can

look up mathworks.com.

%uF0B7 To design a filter, you will need the following two built-in Matlab functions: butter and filter.

[b,a] = butter(filter_order, cutoffrequency/(half of sampling freq.), %u2018low or high%u2019)

filtered_data = filter(b,a,original_data)

2. The sound you recorded using your theremin kit contains many different frequencies. Using the

filters that you designed, filter out the frequencies above 200 Hz and then filter out the frequencies

below 200 Hz. Play those filtered sounds and notice the difference. Also, plot the first 200 points of

both the sound files.3. You have been given a bed sensor data file which contains a signal with the ballistocardiogram

(heartbeat) and the respiration (breathing) along with noise.

a. Write a function which will remove the noise from the bed sensor data. This is achieved using a

low-pass filter.

b. Write a function which will only display the heartbeat from the resulting filtered data (part a).

You will need a high-pass filter.

c. Write a function which will only display respiration from the filtered data (part a). You will need

a low-pass filter.

d. Write a function which plot the raw bed sensor data and the resulting data from parts a,b,c.

Hints:

For this part, you will need to use fir1 and filtfilt.

[b,a] = fir1(filter_order, cutoffrequency/(half of sampling freq.))

filtered_sample = filtfilt(b,a,BedSensorData)

To separate the noise from the bed sensor data, use the following values:

Filter_order = 50 and cutofffrequency = 10

To separate the respiration form the filtered data, use the following values:

Filter_order = 500 and cutofffrequency = 0.3

To separate the heart-beat form the filtered data, use the following values:

Filter_order = 5250 and cutofffrequency = 0.4

The sampling rate is 100.

Im just completely lost on how to do this and its due in a couple hours. Help please!!