Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 2 (60 points): In this problem, you will simulate an analog noisy periodic signal, sample the signal and convert it to a digital signal,

Problem 2 (60 points): In this problem, you will simulate an analog noisy periodic signal, sample the signal and convert it to a digital signal, and write a function to detect the frequency of the original signal. You MUST attach all your codes with your report.

(a) [10 points] Examine the file A2_Prob_2a.m. Write the function fn_updateArray(newValue). This function will save newValue at the end of the array (called arrayWithLatestValues) containing the latest sampled values. Every time a new value is read, the older values will be shifted to the left and the oldest value will be discarded. Run the program a few times and include screenshots of the command window in your report.

(b) [50 points] Examine the file A2_Prob_2b.m. Write the function fn_detectFrequency(...). This function will read the values saved in arrayWithLatestValues and detect the frequency of the signal using the following algorithm:

1. Beginning with the last value saved in arrayWithLatestValues, begin scanning backwards through the array searching for a falling edge in the data (i.e. a value less than threshold at one point in time, then greater than or equal to threshold at the previous point in time). Use a suitable value for threshold.

2. If a falling edge event is detected, store the index at which the event occurs.

3. Ensure that, as the function continues to scan backwards through the array, the data stays above threshold for a number of samples at least equal to hysteresisWindowLength. a. If it does not, reject the threshold event previously detected and return to step 2. b. If it does remain above the threshold for an adequate number of samples, proceed to step 4.

4. When a second falling edge event is detected, store the index at which it occurs.

5. Ensure that the second falling edge event satisfies the hysteresis condition as well. a. If it does not, reject the event and return to step 4. b. If it does remain above the threshold, proceed to step 6.

6. Assume that the time between falling edge events is the signal period. Use this to calculate the apparent signal frequency.

7. Repeat steps 2-6 for the number of periods given by numberOfCyclesToAverage.

8. Average the frequencies. This is the value fn_detectFrequency(...) will return. Vary the signal frequency, threshold and SNR; plot your results and comment on these results. Show how changing the hysteresisWindowLength and numberOfCyclesToAverage can improve the accuracy of frequency detection, especially at higher SNRs.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database Design With Microcomputer Applications

Authors: Glenn A. Jackson

1st Edition

0137718411, 978-0137718412

More Books

Students also viewed these Databases questions

Question

13-1 How does building new systems produce organizational change?

Answered: 1 week ago