tutorbin

signal processing homework help

Boost your journey with 24/7 access to skilled experts, offering unmatched signal processing homework help

tutorbin

Trusted by 1.1 M+ Happy Students

WhatsApp Support

Get Instant
Online Homework Help
via WhatsApp

Get instant homework help from top tutors—just a WhatsApp message away. 24/7 hw help support for all your academic needs!

A
S
M
R
★★★★★
2M+ students trust TutorBin
Your WhatsApp Number
phone
or
⚡ Instant reply
🔒 100% private
👨‍🏫 Top tutors
🌍 All subjects
*Get instant homework help from top tutors—just a WhatsApp message away. 24/7 support for all your academic needs!
2M+ Students Helped24/7 Live SupportExpert TutorsAll Subjects CoveredInstant Response100% ConfidentialTop Rated ServiceMoney-back Guarantee2M+ Students Helped24/7 Live SupportExpert TutorsAll Subjects CoveredInstant Response100% ConfidentialTop Rated ServiceMoney-back Guarantee

Recently Asked signal processing Questions

Expert help when you need it
  • Q1:Focus on the following tasks: Sign-off sheet works (3.1, 3.2). 4.1(a) write beat.m 4.1(b) Test M-file, plot 0.2 sec, measure envelope. 4.2(a) generate and plot beat signal. 4.2(b) Generate spectrogram (WL 2048). 4.2(c) Generate spectrogram (WL 16). 4.3 Synthesize chirp signal and create spectrogram. 4.4 Synthesize chirp signal and create spectrogram for Chirp Puzzle. Write some explanation for this on discussion. Explain results from the previous part 1. the connection between time domain definition of a signal and its frequency domain content 2. waveform in 4.1 and explain its properties 3. on spectrogram and comparison; correct frequencies? 4. on sound of chirp signal; correct frequencies?/n Signal Processing First Lab 03: AM and FM Sinusoidal Signals T Pre-Lab and Warm-Up: You should read at least the Pre-Lab and Warm-up sections of this lab assignment and go over all exercises in the Pre-Lab section before going to your assigned lab session. Verification: The Warm-up section of each lab must be completed during your assigned Lab time and the steps marked Instructor Verification must also be signed off during the lab time. One of the laboratory instructors must verify the appropriate steps by signing on the Instructor Verification line. When you have completed a step that requires verification, simply demonstrate the step to the TA or instructor. Turn in the completed verification sheet to your TA when you leave the lab. Lab Report: It is only necessary to turn in a report on Section 4 with graphs and explanations. You are asked to label the axes of your plots and include a title for every plot. In order to keep track of plots, include your plot inlined within your report. If you are unsure about what is expected, ask the TA who will grade your report. 1 Introduction The objective of this lab is to introduce more complicated signals that are related to the basic sinusoid. These signals, which implement frequency modulation (FM) and amplitude modulation (AM), are widely used in communication systems such as radio and television, but they also can be used to create interesting sounds that mimic musical instruments. There are a number of demonstrations on the CD-ROM that provide examples of these signals for many different conditions. 2 Pre-Lab We have spent a lot of time learning about the properties of sinusoidal waveforms of the form: x(t) = A cos(2π fot + 6) = Re { Aejøej 2π fot} (1) In this lab, we will extend our treatment of sinusoidal waveforms to more complicated signals composed of sums of sinusoidal signals, or sinusoids with changing frequency. 2.1 Amplitude Modulation If we add several sinusoids, each with a different frequency (fk) we can express the result as: N N xr(t) = Σ Ak cos (27 fxt + ox) = 3 {[(Anej øk) c2m fit } j2π k=1 k=1 McClellan, Schafer, and Yoder, Signal Processing First, ISBN 0-13-065562-7. Prentice Hall, Upper Saddle River, NJ 07458. ©2003 Pearson Education, Inc. (2) where Arejk is the complex amplitude of the kth complex exponential term. The choice of f/ will deter- mine the nature of the signal for amplitude modulation or beat signals we pick two or three frequencies very close together. See Chapter 3 for a more detailed discussion of beat signals. CD-ROM Chap3 Demos FM Syn- thesis 2.2 Frequency Modulated Signals We will also look at signals in which the frequency varies as a function of time. In the constant-frequency sinusoid (1) the argument of the cosine is also the exponent of the complex exponential, so the angle of this signal is the exponent (2π fot +). This angle function changes linearly versus time, and its time derivative is 2π fo which equals the constant frequency of the cosine in rad/sec. A generalization is available if we adopt the following notation for the class of signals represented by a cosine function with a time-varying angle: x(t) = A cos(v(t)) = {Aej(t)} The time derivative of the angle from (3) gives a frequency in rad/sec wi(t) = (t) (rad/sec) d dt but we prefer units of hertz, so we divide by 2π to define the instantaneous frequency: 1 d fi(t) = 2/(t) (Hz) 2π dt 2.4 MATLAB Synthesis of Chirp Signals The following MATLAB code will synthesize a chirp: = 11025; 2.3 Chirp, or Linearly Swept Frequency A chirp signal is a sinusoid whose frequency changes linearly from a starting value to an ending one. The formula for such a signal can be defined by creating a complex exponential signal with quadratic angle by defining (t) in (3) as fsamp dt dur = 1.8; tt = 0 : dt: dur; psi XX = real ( 7.7*exp(j*psi) ); soundsc (xx, fsamp); T y(t) = 2ñµt² + 2π fot + þ The derivative of ½(t) yields an instantaneous frequency (4) that changes linearly versus time. fi(t) = 2ut + fo - The slope of fi(t) is equal to 2µ and its intercept is equal to fo. If the signal starts at time t 0 secs., then fo is also the starting frequency. The frequency variation produced by such a time-varying angle is called frequency modulation. This kind of signal is an example of an frequency modulated (FM) signal. More generally, we often consider them to be part of a larger class called angle modulation signals. Finally, since the linear variation of the frequency can produce an audible sound similar to a siren or a chirp, the linear-FM signals are also called "chirps." = = 1/fsamp; 2*pi* (100 + 200*tt + 500*tt.*tt); (3) (4) McClellan, Schafer, and Yoder, Signal Processing First, ISBN 0-13-065562-7. Prentice Hall, Upper Saddle River, NJ 07458. ©2003 Pearson Education, Inc. (a) Determine the total duration of the synthesized signal in seconds, and also the length of the tt vector (number of samples). 2 CD-ROM FM Syn- thesis CD-ROM Spectrograms Sounds: Wide- band FM (b) In MATLAB, signals can only be synthesized by evaluating the signal's defining formula at discrete instants of time. These are called samples of the signal. For the chirp we do the following: x(tn) = А cos(2πµt² + 2π fotn + 0) where tn nT, represents discrete time instants. In the MATLAB code above, what is the value for tn? What are the values of A, µ, fo, and o? = (c) Determine the range of frequencies (in hertz) that will be synthesized by the MATLAB script above. Make a sketch by hand of the instantaneous frequency versus time. What are the minimum and maximum frequencies that will be heard? (d) Listen to the signal to determine whether the signal's frequency content is increasing or decreasing (use soundsc()). Notice that soundsc () needs to know the sampling rate at which the signal samples were created. For more information do help sound and help sound (). 3 Warm-up The instructor verification sheet may be found at the end of this lab. The "Beat Control GUI" is part of the SP First toolbox. 3.1 Beat Control GUI To assist you in your experiments with beat notes and AM signals, the tool called beatcon has been created. This user interface controller will exhibit the basic signal shapes for beat signals and play the signals. A small control panel will appear on the screen with buttons and sliders that vary the different parameters for the beat signals. It can also call a user-written function called beat.m. Experiment with the beat con control panel and use it to produce a beat signal with two frequency components at 850 Hz and 870 Hz. Demonstrate the plot and sound to your TA. Instructor Verification (separate page) 3.2 Function for a Chirp Use the code provided in the warm-up as a starting point in order to write a MATLAB function that will synthesize a "chirp" signal according to the following comments: function MYCHIRP 응 응 usage: 응 응 f1 = £2 = dur = T 응 응 fsamp % 응 = XX = tt = [xx,tt] = mychirp f1, f2, dur, fsamp) generate a linear-FM chirp signal XX = mychirp f1, f2, dur, fsamp) starting frequency ending frequency total time duration sampling frequency (OPTIONAL: default is 11025) (vector of) samples of the chirp signal vector of time instants for t=0 to t=dur McClellan, Schafer, and Yoder, Signal Processing First, ISBN 0-13-065562-7. Prentice Hall, Upper Saddle River, NJ 07458. ©2003 Pearson Education, Inc. 3 CD-ROM beatcon.m if( nargin < 4 ) fsamp = 11025; T -- Allow optional input argument end As a test case, generate a chirp sound whose frequency starts at 2500 Hz and ends at 500 Hz; its duration should be 1.5 sec. Listen to the chirp using the soundsc function. Include a listing of the mychirp.m function that you wrote. Instructor Verification (separate page) 3.3 Advanced Topic: Spectrograms It is often useful to think of signals in terms of their spectra. A signal's spectrum is a representation of the frequencies present in the signal. For a constant frequency sinusoid as in (1) the spectrum consists of two components, one at 2π fo, the other at -2 fo. For more complicated signals, the spectrum may be very interesting and, in the case of FM, the spectrum is considered to be time-varying. One way to represent the time-varying spectrum of a signal is the spectrogram (see Chapter 3 in the text). A spectrogram is found by estimating the frequency content in short sections of the signal. The magnitude of the spectrum over individual sections is plotted as intensity or color on a two-dimensional plot versus frequency and time. When unsure about a command, use help. There are a few important things to know about spectrograms: 1. In MATLAB the function specgram will compute the spectrogram, as already explained in a recent lecture. Type help specgram to learn more about this function and its arguments. 2. Spectrograms are numerically calculated and only provide an estimate of the time-varying frequency content of a signal. There are theoretical limits on how well spectrograms can actually represent the frequency content of a signal. A later lab will treat this problem when we use the spectrogram to extract the frequencies of piano notes. 3. A common call to the function is specgram (xx, 1024, fs). The second argument¹ is the window length which could be varied to get different looking spectrograms. The spectrogram is able to "see" the separate spectrum lines with a longer window length, e.g., 1024 or 2048.² 4. If you are working at home, you might not have the specgram () function because it is part of the "Signal Processing Toolbox." In that case, use the function plotspec (xx, fs) which was loaded when you installed the SP First toolbox. = McClellan, Schafer, and Yoder, Signal Processing First, ISBN 0-13-065562-7. Prentice Hall, Upper Saddle River, NJ 07458. ©2003 Pearson Education, Inc. ● Note: The argument list for plot spec () has a different order from specgram, because plotspec () uses an optional third argument for the window length (default value is 256). In addition, plotspec () does not use color for the spectrogram; instead, darker shades of gray indicate larger values with black being the largest. In order to see what the spectrogram produces, run the following code: fs=8000; xX cos (3000*pi* (0:1/fs:0.5)); specgram (xx, 1024, fs); colorbar or, if you are using plotspec (xx,fs): fs=8000; xx = cos (3000*pi* (0:1/fs:0.5)); plotspec (xx, fs,1024); colorbar Notice that the spectrogram image contains one horizontal line at the correct frequency of the sinusoid. 'If the second argument is made equal to the "empty matrix" then its default value of 256 is used. 2Usually the window length is chosen to be a power of two, because a special algorithm called the FFT is used in the computa- tion. The fastest FFT programs are those where the signal length is a power of 2. CD-ROM 4 Sounds & Spec- trograms 4 Lab Exercise: Chirps and Beats For the lab exercise and lab report, you will synthesize some AM and FM signals. In order to verify that they have the correct frequency content, you will use the spectrogram. Your lab report should discuss the connection between the “time-domain" definition of the signal and its "frequency-domain" content. 4.1 Beat Notes In the section on beat notes in Chapter 3 of the text, we analyzed the situation in which we had two sinusoidal signals of slightly different frequencies; i.e., x(t) = A cos(2π (fc − ƒ^)t) + B cos(2π(fc + ƒ^)t) In this part, we will compute samples of such a signal and listen to the result. (a) Write an M-file called beat.m that implements (5) and has the following as its first lines: function %BEAT 응 응 응 응 olo olo olo olo 응 응 응 % 응 010 010 응 usage: [xx, tt] = beat (A, B, fc, delf, fsamp, dur) samples of the sum of two cosine waves compute [xx, tt] = T --Second Output: A = amplitude of lower frequency cosine B = amplitude of higher frequency cosine fc = center frequency delf = frequency difference fsamp sampling rate dur = XX = beat (A, B, fc, delf, fsamp, dur) total time duration in seconds output vector of samples tt = time vector corresponding to xx (5) Include a copy of your M-file in your lab report. You might want to call the syn_sin () function written in Lab 2 to do the calculation. The function should also generate its own time vector, because that vector can be used to define the horizontal axis when plotting. (b) To assist you in your experiments with beat notes, a tool called beat con has been created. This user interface controller is able to call your function beat.m, if you check the box Use External beat() in the lower left-hand corner of the GUI. Therefore, before you invoke beatcon you should be sure your M-file is free of errors. Also, make sure that your beat.m function is on the MATLAB path. Test the M-file written in part (a) via beatcon by using the values A=10, B=10, fc=1000, delf=10, fsamp=11025, and dur=1 secs. Plot the first 0.2 seconds of the resulting signal. De- scribe the waveform and explain its properties. Hand in a copy of your plot with measurements of the period of the "envelope" and period of the high frequency signal underneath the envelope. McClellan, Schafer, and Yoder, Signal Processing First, ISBN 0-13-065562-7. Prentice Hall, Upper Saddle River, NJ 07458. ©2003 Pearson Education, Inc. (c) (Optional)³ Experiment with different values of the frequency difference f▲. Listen to the sounds (there is a button on beat con that will do this for you automatically) and think about the relationship between the sound and waveform. 3"Optional" means that you do not have to include this in your lab report. 5 CD-ROM beatcon.mSee Answer
  • Q2: BE 312 Lab #3 LAB 3: Stretch Receptors and Reflexes I. Background Studying the vertebrate stretch reflex is a good way to introduce students to the topics of stretch receptors, nerve conduction velocity, electromyograms (EMG), and motor control. Specialized receptors in the muscle respond to the stretching of the tendon attached to the muscle, and then send signals to motorneurons through a single synapse. The muscle fibers depolarize and twitch (contract) in response to the incoming impulse from the motorneuron. The Stretch Receptor Skeletal muscles have specialized receptors which convey information about muscle length, tension, and pressure to the central nervous system. The sensory receptors responsible for providing information about the length, or the rate of change of the length, of a muscle are called muscle spindles. Arranged in parallel with muscle fibers, the spindles are stretched when the muscle is stretched by an external force. Therefore, these receptors play a significant role in developing antigravity reflexes and maintaining muscle tone. Muscle spindles contain a small bundle of intrafusal fibers which do not contribute to the overall tension of the muscle, but regulate the excitability of the sensory afferent spindle nerves by mechanically deforming the receptors. These fibers are innervated by gamma motor neurons. Much of a muscle consists of extrafusal fibers, which are innervated by alpha motor neurons and are responsible for developing muscle tension. Motor Fibers Sensory Fiber Intrafusal Fibers Fluid Cavity Extrafusal Fibers Muscle Muscle Spindle Sensory Neuron Motor Endplates Motor Neuron Spinal Cord Figure HN-2-B1: A monosynaptic stretch reflex arc. The Stretch Reflex When a muscle is stretched, excitation of its muscle spindles causes a reflex contraction of the muscle. This reflex response is known as a stretch (myotatic) reflex. The minimal delay between the muscle stretching and the reflex contraction is due to its monosynaptic pathway. The sensory afferent nerves from the spindles synapse directly with motor neurons; there are no interneurons. This pathway constitutes the shortest possible reflex arc. 1 BE 312 Lab #3 Rectus Femoris Vastus Lateralis Patellar Ligament Tibialis anterior Tibia -Biceps Femoris Femur -Soleus -Gastrocnemius (Lateral Head) - Fibula Achilles Tendon HN-2-1 Figure HN-2-B2: The major extensors and flexors of the human knee and ankle joints. The stretch reflexes used in this exercise are elicited by striking the patellar tendon or the Achilles tendon. As an example of the stretch reflex, consider the reflex response that occurs when a person jumps from a low stool to the floor. The extensor muscles of the legs are stretched on landing, lengthening all their muscle spindles. The discharge of the muscle spindles is conveyed to the central nervous system through the fast-conducting afferent axons. These sensory axons enter the spinal cord through the dorsal root and synapse with the motor neurons of the same extensor muscle. In turn, the motor neurons trigger the contraction of the extensor muscle to oppose the stretch produced by landing, completing the reflex arc. This reflex is one of the main reasons you keep your balance and do not fall when changing certain body positions. In this lab, students will record electromyograms (EMGs), the summation of asynchronous electrical activity (muscle action potentials) in the multiple fibers in the muscle, and use them to determine the time between the stretch of the tendon and the arrival of the motor impulse at the muscle. Two reflexes in a human subject will be studied: the Achilles tendon reflex, and the patellar tendon (knee-jerk) reflex. Conduction times and nerve velocities for each reflex arc will be determined and compared. The effect of pre-existing tension in the effector muscle, or motor activity in other muscle groups, upon reflex responses will be measured. The coordination of motor activity in antagonistic muscles will also be studied. 2 BE 312 Lab #3 II. Setup Equipment Required ● ● ● PC or Mac Computer IXTA, USB cable, IXTA power supply ROAM EMG Alcohol swabs Disposable EMG electrodes PRH-100/PRH-200 Patellar reflex hammer Settings -> Human Nerve-> StretchReceptorReflex-ROAM EMG Cable and Reflex Hammer Setup 1. Locate Patellar Reflex Hammer and plug the BNC connector into Channel A3. 3. 2. Disconnect the ROAM EMG from the dock and place the electrodes as shown in Figure 1. Use an alcohol swab to clean and abrade two regions on the calf of the left leg for electrode attachment. One area is in the middle of the calf muscle, and the second area is about 3 inches below the back of the knee (see Figure 2). Let the areas dry. 4. Remove the plastic disk from a disposable electrode and apply it to one of the abraded areas. Repeat for the other area. Worx TA-ROAM Figure 2. Electrode placement on leg. A4 AS AB REKAM (a) (b) Figure 1. (a) The PRH-200 Reflex Hammer to be plugged into Channel A3. (b) The ROAM device for wireless measurements. 3 BE 312 Lab #3 5. Attach the two color-coded electrode leads as shown in Figure 2 for the Achilles Reflex. III. Experiments Exercise 1: Achilles Tendon Reflex Aim: To determine conduction time from tendon tap to response of the gastrocnemius muscle in the Achilles tendon reflex arc. Approximate Time: 20 minutes Procedure 1. Instruct the subject to sit on a lab bench so that the subject's thighs are supported by the top of the bench and his or her calves hang freely. 2. The Achilles tendon is located above the heel and connects the gastrocnemius muscle to the tarsal bone of the foot. Tap the tendon with the wide end of the reflex hammer a few times to locate a point on the tendon which produces a consistent contraction of the gastrocnemius muscle and a downward movement of the foot (plantar flexion). The opposite, upward movement is known as dorsiflexion. 3. Click Record and then instruct the subject to move his or her foot up and down to demonstrate the type of EMG that occurs during plantar flexion and dorsiflexion. Click AutoScale All. 4. Type Achilles in the Mark box. Click the mark button to mark the recording. Continue recording. 5. Tap the subject's Achilles tendon to elicit the stretch reflex. Record a total of five trials using the same tapping force. 6. After the fifth trial, click Stop to halt recording. 7. Select Save As in the File menu, type a name for the file. 8. Repeat this exercise on the same subject using three different amounts of force. Exercise 2: Patellar Tendon (Knee Jerk) Reflex Aim: To determine conduction time from tendon tap to response of the quadriceps muscle in the patellar tendon reflex arc. Approximate Time: 40 minutes Software Changes Click on the Settings menu and select the PatellarStretchReflex settings file. Procedure 1. Instruct the subject to sit on a lab bench so that the subject's thighs are supported by the top of the bench and his or her calves hang freely. 2. Remove the lead wires of the EMG recording cable from the electrodes over the subject's calf muscle. Keep these electrodes on the subject's calf muscle. 3. Place a new set of recording electrodes on the quadriceps muscle of the subject on the medial side of the thigh, so that: the black (-1) lead wire is attached to an electrode which is about 12 cm from the knee. 4 BE 312 Lab #3 the red (+1) lead wire is attached to an electrode which is about 10 cm above the negative electrode (see Figure 3). RAM Figure 3. Circuit diagram for recording EMGs from the thigh muscles. Using the iWireB3G on the left and the wireless ROAM on the right. Note: Ignore the green wire 4. Feel the position of the patellar tendon just below the kneecap. Place one hand on the patella (kneecap), and use the other hand to tap the patellar tendon with the reflex hammer. Find the point on the patellar tendon that causes the greatest response from the quadriceps muscle. 5. Click Record and then instruct the subject to raise and lower his or her lower leg to demonstrate the type of EMG that occurs during quadriceps contraction and relaxation. Click AutoScale All. Click Stop to halt the recording. 6. Type Patellar in the Mark box. 7. Click Record and then click the mark button to mark the recording. 8. Instruct the subject to relax his or her quadriceps muscle and that the exercise has begun. 9. Tap the subject's patellar tendon to elicit the stretch reflex. Record a total of five trials using the same tapping force. 10. After the fifth trial, click Stop to halt recording. 11. Select Save in the File menu. 12. Repeat this exercise on the same subject while the subject is voluntarily contracting his or her quadriceps. 5See Answer
  • Q3: Signal Processing First Lab 04: Synthesis of Sinusoidal Signals-Music Synthesis T Pre-Lab and Warm-Up: You should read at least the Pre-Lab and Warm-up sections of this lab assignment and go over all exercises in the Pre-Lab section before going to your assigned lab session. Verification: The Warm-up section of each lab must be completed during your assigned Lab time and the steps marked Instructor Verification must also be signed off during the lab time. One of the laboratory instructors must verify the appropriate steps by signing on the Instructor Verification line. When you have completed a step that requires verification, simply demonstrate the step to the TA or instructor. Turn in the completed verification sheet to your TA when you leave the lab. Lab Report: It is only necessary to turn in a report on Section 4 with graphs and explanations. You are asked to label the axes of your plots and include a title for every plot. In order to keep track of plots, include your plot inlined within your report. If you are unsure about what is expected, ask the TA who will grade your report. 1 Introduction This lab includes a project on music synthesis with sinusoids. The piece, Fugue #2 for the Well-Tempered Clavier by Bach¹ has been selected for doing the synthesis program. The project requires an extensive programming effort and should be documented with a complete formal lab report. A good report should include the following items: a cover sheet, commented MATLAB code, explanations of your approach, conclusions and any additional tweaks that you implemented for the synthesis. Since the project must be evaluated by listening to the quality of the synthesized song, the criteria for judging a good song are given at the end of this lab description. In addition, it may be convenient to place the final song on a web site so that it can be accessed remotely by a lab instructor who can then evaluate its quality. If you would like to try other songs, the SP First CD-ROM includes information about alternative tunes: Minuet in G, Für Elise, Beethoven's Fifth, Jesu, Joy of Man's Desiring and Twinkle, Twinkle, Little Star. The music synthesis will be done with sinusoidal waveforms of the form x(t) = Σ Ak cos(wkt + Ok) k (1) so it will be necessary to establish the connection between musical notes, their frequencies, and sinusoids. A secondary objective of the lab is the challenge of trying to add other features to the synthesis in order to improve the subjective quality for listening. Students who take this challenge will be motivated to learn more about the spectral representation of signals a topic that underlies this entire course. McClellan, Schafer, and Yoder, Signal Processing First, ISBN 0-13-065562-7. Prentice Hall, Upper Saddle River, NJ 07458. ©2003 Pearson Education, Inc. 2 Pre-Lab In this lab, the periodic waveforms and music signals will be created with the intention of playing them out through a loudspeaker. Therefore, it is necessary to take into account the fact that a conversion is needed from the digital samples, which are numbers stored in the computer memory to the actual voltage waveform that will be amplified for the speakers. ¹See http://www.hnh.com/composer/bach.htm. CD-ROM MUSIC SYN- THESIS 2.1 Theory of Sampling Chapter 4 treats sampling in detail, but this lab is usually done prior to lectures on sampling, so we provide a quick summary of essential facts here. The idealized process of sampling a signal and the subsequent reconstruction of the signal from its samples is depicted in Fig. 1. This figure shows a continuous-time input x(t) x[n] = x(nTs) y(t) C-to-D Converter D-to-C Converter T Figure 1: Sampling and reconstruction of a continuous-time signal. signal ä(t), which is sampled by the continuous-to-discrete (C-to-D) converter to produce a sequence of samples x[n] = x(nTs), where n is the integer sample index and T, is the sampling period. The sampling rate is fs = 1/T, where the units are samples per second. As described in Chapter 4 of the text, the ideal discrete-to-continuous (D-to-C) converter takes the input samples and interpolates a smooth curve between them. The Sampling Theorem tells us that if the input signal x(t) is a sum of sine waves, then the output y(t) will be equal to the input x(t) if the sampling rate is more than twice the highest frequency ƒmax in the input, i.e., ƒs > 2ƒmax. In other words, if we sample fast enough then there will be no problems synthesizing the continuous audio signals from x[n]. 2.2 D-to-A Conversion Most computers have a built-in analog-to-digital (A-to-D) converter and a digital-to-analog (D-to-A) con- verter (usually on the sound card). These hardware systems are physical realizations of the idealized con- cepts of C-to-D and D-to-C converters respectively, but for purposes of this lab we will assume that the hardware A/D and D/A are perfect realizations. The digital-to-analog conversion process has a number of aspects, but in its simplest form the only thing we need to worry about at this point is that the time spacing (Ts) between the signal samples must correspond to the rate of the D-to-A hardware that is being used. From MATLAB, the sound output is done by the soundsc (xx, fs) function which does support a variable D-to-A sampling rate if the hardware on the machine has such capability. A convenient choice for the D-to-A conversion rate is 11025 samples per second, so Tg = 1/11025 seconds; another common choice is 8000 samples/sec. Both of these rates satisfy the requirement of sampling fast enough as explained in the next section. In fact, most piano notes have relatively low frequencies, so an even lower sampling rate could be used. If you are using soundsc (), the vector xx will be scaled automatically for the D-to-A converter, but if you are using sound.m, you must scale the vector xx so that it lies between ±1. Consult help sound. = = (a) The ideal C-to-D converter is, in effect, being implemented whenever we take samples of a continuous- time formula, e.g., x(t) at t tn. We do this in MATLAB by first making a vector of times, and then evaluating the formula for the continuous-time signal at the sample times, i.e., x[n] = x(nT,) if tn = nTs. This assumes perfect knowledge of the input signal, but we have already been doing it this way in previous labs. To begin, create a vector x1 of samples of a sinusoidal signal with A₁ 100, W₁ = 2T (800), and Φ1 -T/3. Use a sampling rate of 11025 samples/second, and compute a total number of samples equivalent to a time duration of 0.5 seconds. You may find it helpful to recall that a MATLAB statement such as tt- (0:0.01:3); would create a vector of numbers from 0 through 3 with increments of 2This sampling rate is one quarter the rate (44,100 Hz) used in audio CD players. McClellan, Schafer, and Yoder, Signal Processing First, ISBN 0-13-065562-7. Prentice Hall, Upper Saddle River, NJ 07458. ©2003 Pearson Education, Inc. = 2 0.01. Therefore, it is only necessary to determine the time increment needed to obtain 11025 samples in one second. You should use the syn_sin () function from a previous lab for this part. Use soundsc() to play the resulting vector through the D-to-A converter of the your computer, assuming that the hardware can support the f 11025 Hz rate. Listen to the output. = (b) Now create another vector x2 of samples of a second sinusoidal signal (0.8 secs. in duration) for the case A₂ 80, W₂ = 27 (1200), and 2 +π/4. Listen to the signal reconstructed from these samples. How does its sound compare to the signal in part (a)? = (c) Concatenate the two signals x1 and x2 with a short duration of 0.1 seconds of silence in between. You should be able to use a statement something like: = assuming that both x1 and x2 are row vectors. Determine the correct value of N to make 0.1 seconds of silence. Listen to this new signal to verify that it is correct. T (d) To verify that the concatenation operation was done correctly in the previous part, make the following plot: XX = tt = (1/11025) * (1:length (xx) ) ; plot ( tt, xx ); This will plot a huge number of points, but it will show the "envelope" of the signal and verify that the amplitude changes from 100 to zero and then to 80 at the correct times. Notice that the time vector tt was created to have exactly the same length as the signal vector xx. = 7; [ x1, zeros (1,N), x2 ]; (e) Now send the vector xx to the D-to-A converter again, but change the sampling rate parameter in soundsc (xx, fs) to 22050 samples/second. Do not recompute the samples in xx, just tell the D-to-A converter that the sampling rate is 22050 samples/second. Describe how the duration and pitch of the signal were affected. Explain. x. Amp x.phase x. freq = 100; x.fs = 11025 x.time Interval = 2.3 Structures in MATLAB MATLAB can do structures. Structures are convenient for grouping information together. For example, run the following program which plots a sinusoid: = -pi/2; 0: (1/x.fs):0.05; x.values = x. Amp*cos (2*pi* (x.freq) * (x.timeInterval) + x.phase); x. name = 'My Signal'; X ---- echo the contents of the structure "x" plot ( x.time Interval, x.values ) title( x.name ) Notice that the members of the structure can contain different types of variables: scalars, vectors or strings. 2.4 Debugging Skills Testing and debugging code is a big part of any programming job, as you know if you been staying up late on the first few labs. Almost any modern programming environment provides a symbolic debugger so that break-points can be set and variables examined in the middle of program execution. Of course, many McClellan, Schafer, and Yoder, Signal Processing First, ISBN 0-13-065562-7. Prentice Hall, Upper Saddle River, NJ 07458. ©2003 Pearson Education, Inc. 3 programmers insist on using the old-fashioned method of inserting print statements in the middle of their code (or the MATLAB equivalent, leaving off a few semi-colons). This is akin to riding a tricycle to commute around Atlanta. In order to learn how to use the MATLAB tools for debugging, try help debug. Here is part of what you'll see: dbstop dbclear dbcont dbstack dbstatus dbstep dbtype dbquit Set breakpoint. Remove breakpoint. Resume execution. List who called whom. List all breakpoints. Execute one or more lines. List M-file with line numbers. Quit debug mode. When a breakpoint is hit, MATLAB goes into debug mode. On the PC and Macintosh the debugger window becomes active and on UNIX and VMS the prompt changes to a K>. Any MATLAB command is allowed at the prompt. To resume M-file function execution, use DBCONT or DBSTEP. To exit from the debugger use DBQUIT. One of the most useful modes of the debugger causes the program to jump into “debug mode" whenever an error occurs. This mode can be invoked by typing: dbstop if error With this mode active, you can snoop around inside a function and examine local variables that probably caused the error. You can also choose this option from the debugging menu in the MATLAB editor. It's sort of like an automatic call to 911 when you've gotten into an accident. Try help dbstop for more information. Use the following to stop debugging T dbclear if error Create an M-filecoscos.m containing the code below and use the debugger to find the error(s) in the function. Call the function with the test case: [xn, tn] coscos (2,3,20,1). Use the debugger to: 1. Set a breakpoint to stop execution when an error occurs and jump into “Keyboard" mode, 2. display the contents of important vectors while stopped, 3. determine the size of all vectors by using either the size () function or the whos command. 4. and, lastly, modify variables while in the "Keyboard" mode of the debugger. cosl = cos (2*pi*f1*t1); cos2 = cos (2*pi*f2*t2); function [xx,tt] = coscos (fl, f2, fs, dur ) % COSCOS multiply two sinusoids 응 t1 = 0: (1/fs): dur; t2 = 0: (1/f2): dur; xx = cos1 * cos2; tt = tl; = McClellan, Schafer, and Yoder, Signal Processing First, ISBN 0-13-065562-7. Prentice Hall, Upper Saddle River, NJ 07458. ©2003 Pearson Education, Inc. 2.5 Piano Keyboard Section 4 of this lab will consist of synthesizing the notes of a well known piece of music.³ Since these signals require sinusoidal tones to represent piano notes, a quick introduction to the frequency layout of the piano keyboard is needed. On a piano, the keyboard is divided into octaves-the notes in one octave being twice the frequency of the notes in the next lower octave. For example, the reference note is the A above OCTAVE- T 41 43 C3 D3 E3 F3 G3 A3 B3 C4 D4 E4 F4 G4 A4 B4 C5 D5 E5 F5 G5 A5 B5 28 30 32 33 35 37 39 40 42 44 45 47 49 51 52 54 56 57 59 61 63 Middle-C A-440 Figure 2: Layout of a piano keyboard. Key numbers are shaded. The notation C4 means the C-key in the fourth octave. middle-C which is usually called A-440 (or A4) because its frequency is 440 Hz. (In this lab, we are using the number 40 to represent middle C. This is somewhat arbitary; for instance, the Musical Instrument Digital Interface (MIDI) standard represents middle C with the number 60). Each octave contains 12 notes (5 black keys and 7 white) and the ratio between the frequencies of the notes is constant between successive notes. As a result, this ratio must be 2¹/¹2. Since middle C is 9 keys below A-440, its frequency is approximately 261 Hz. Consult chapter 9 for even more details. Musical notation shows which notes are to be played and their relative timing (half, quarter, or eighth). Figure 3 shows how the keys on the piano correspond to notes drawn in musical notation. The white keys are all labeled as A, B, C, D, E, F, and G; but the black keys are denoted with "sharps" or "flats." A sharp such as A# is one key number larger than A; a flat is one key lower, e.g., A½ is key number 48. TREBLE F-SHARP -BASS f 21 EIGHTH NOTE HALF NOTE 8< 42 44. D4 QUARTER NOTE E4 T 39 37 B3 -46- -47. F#4 35 -A4 = (A-440) -49- 40 -B 34 32- 30 F#3- McClellan, Schafer, and Yoder, Signal Processing First, ISBN 0-13-065562-7. Prentice Hall, Upper Saddle River, NJ 07458. ©2003 Pearson Education, Inc. 52 -C4 (middle-C) -28 27. C3 B₂ Figure 3: Musical notation is a time-frequency diagram where vertical position indicates which note is to be played. Notice that the shape of the note defines it as a half, quarter or eighth note, which in turn defines the duration of the sound. ³If you have little or no experience reading music, don't be intimidated. Only a little music knowledge is needed to carry out this lab. On the other hand, the experience of working in an application area where you must quickly acquire knowledge is a valuable one. Many real-world engineering problems have this flavor, especially in signal processing which has such a broad applicability in diverse areas such as geophysics, medicine, radar, speech, etc. 5See Answer
  • Q4:Problem 3 [30 points]: Let x[n] be a signal with Fourier transform as shown below. X(w) Π ° π Π Determine and sketch the Fourier transforms of the following signals: (a) x₁[n] = x[n] cos(0.25πn). Can you recover the original signal x[n] from x₁[n] by filtering? [10 points] NOTE: Watch out for overlap between upper and lower sidebands. SOLUTION: (b) x2 [n] = x[n] sin(0.5πn) [10 points] HINT: sin 0 = 2j [eje - e-je]See Answer
  • Q5:Problem 1 [25 points]: An FIR filter of length 3 is defined by the system function H(z) = h[0]+h[1]z¯¹+h[2]z¯². It exhibits a symmetric impulse response; that is, h[0] = h[2]. Let the input to this filter be a sum of two cosine sequences of angular frequencies 0.3 rad/samples and 0.6 rad/samples, respectively. (a) Determine the impulse response coefficients h[0], h[1] so that the filter passes only the low frequency component of the input. [15 points] HINT: Use DTFT definition to show that |H(e)| = |H(z)|ze| = 2h[0] cos 0+h[1]. Setup two equations for the two conditions: |H(e10.3)| = 1,|H(e/0.6)| = Oand solve for the two unknown impulse response coefficients. SOLUTION: h[0] = h[2] =? h[1] =? (b) Plot the magnitude and phase spectra of the designed filter in part (a) above using MATLAB. [10 points] HINT: You may use MATLAB freqz(b,a) function.See Answer
  • Q6: Signal Processing Project For this project, you will be applying several signal processing algorithms to several instances of a given type of one-dimensional data set of your choice. Possible choices include: A) ECG B) EEG C) speech D) ultrasound-based 1D dataset You will analyze at least 3 waveforms (1D) from the data set of your choice using 3 (or more) algorithms of your choice for a particular purpose. This makes a minimum of 3x3=9 analyses. That purpose could be to detect a feature or attribute of interest (like heart rate or the relative t wave amplitude for ECG), to analyze frequency content, or to reduce noise and enhance the signal, for instance. Possible algorithms include: a) peak finding b) frequency filtering c) smoothing d) noise reduction f) spectrogram g) short-time Fourier Transform (STFT) h) frequency content analysis You will share your preliminary results with a classmate during class and include a summary in your project report (for part of the grade). The final report (3-5 pages, not including code) will cover your own analysis. Specifically, include in a few paragraphs on each algorithm you used, describe: • what you did to implement the algorithm? . what were the results? (include figures) why/when is this useful? In your final project submission include: • analysis.m files data files (if not built in or provided on eLearning) project report document (.docx, .pdf) If you wish to propose a challenging project of your own talk to me individually. Ground rules: You need to do independent original work. While you may use built-in functions from MATLAB, do not copy the examples or use code directly copied from the web. It is OK to use such code for inspiration. Do not use a project from another course. You can get started with waveforms built into MATLAB (some are not available in latest MATLAB versions, so this also available as a .zip in eLearning): load wecg; % ECG signal sampled at 180 Hz load mit200% The ECG data and annotations are taken from the MIT-BIH Arrhythmia Database. The data are sampled at 360 Hz. load mit203 % The ECG data and annotations are taken from the MIT-BIH Arrhythmia Database (with noise). The data are sampled at 360 Hz. load Espiga3; % 23 channel EEG data sampled at 200 Hz Or, you can use waveforms from a UTD lab you are associated with, or from the web (Kaggle.com is a one source).See Answer
  • Q7:Problems 1. Find the received power P, expected from a radar and target having the following parameters: RF frequency=95 GHz (W band), transmitted power = 100 W, antenna beamwidth = 2º in azimuth and 5º in elevation, system losses = 5 dB, target range = 3 km, target RCS = 20 m². Use Fig. 1.3 and assume operation near sea level to estimate atmospheric losses. What is the ratio in decibels of the received power to the transmitted power?See Answer
  • Q8:Visual T..S T₂ ·235 T₂.525 .48 .49 TA T5 ть T₂ FFF ·57 BE 312 Lab #2 2. Enter the mean reaction time for this exercise in Table 1. Exercise 4 Data Analysis 1. Use the same technique explained in Exercise 1 to measure and record the reaction times of the subject presented with predictable auditory signals. 2. Enter the mean reaction time for this exercise in Table 1. FINAL STEP: Enter your mean RT data into the spreadsheet provided. Name this spreadsheet TeamLxxx_lab2.xlsx where xxx is your team #. Upload this to the Box folder for Lab2. This must be done before Monday. Table 1: Mean Reaction Times for Different Signals. • T₂ TA Ts T₂ T₂- TB 18 Та То Auditory Signal Visual Auditory Prompted Auditory ·5 .52 •605 Report Questions 49 1. Include a completed Table 1 Questions Exercise 1 and 2 Predictable Auditory Mean Reaction Time of Your Subject (ms) Mean Reaction Time of All Subjects (ms) 0.045 0.125 0.035 Shortest Mean Reaction Time in Class (ms) Longest Mean Reaction Time in Class (ms) 2. How does the subject's mean reaction time to visual signals compare to his or her mean reaction time to auditory signals? 3. What would cause a longer reaction time to one type of signal as compared to another? 4. How do your subject's mean reaction times compare to those of other subjects? 5. Do all subjects respond more quickly to the same signal? 71-0-025 T₁-0-125 0.070 Questions Exercise 3 and 4 6. To which auditory signal did your subject respond most quickly? -0.055 7. To which auditory signal did your subject respond to most slowly? For what reasons? 0.055 8. Did your subject respond more quickly or more slowly to same auditory signal as the other members of the class? -0.195 -0.070 Prompted Auditony 9. Using the entire class data, create scatter plots of the Mean Reaction time for all subjects for each of the four cases. Comment on each of these. 0-125 0.115 -0.105 0.035 0.105 0.055 0-170 0.125 0.145 Predictable Auditony 0045 0.125 0.015 0.185 0.035 0.035 0.185 0.055 -0.035 0.135 -0.025See Answer
  • Q9: Signal Processing First Lab 02: Introduction to Complex Exponentials - Multipath T Pre-Lab and Warm-Up: You should read at least the Pre-Lab and Warm-up sections of this lab assignment and go over all exercises in the Pre-Lab section before going to your assigned lab session. Verification: The Warm-up section of each lab must be completed during your assigned Lab time and the steps marked Instructor Verification must also be signed off during the lab time. One of the laboratory instructors must verify the appropriate steps by signing on the Instructor Verification line. When you have completed a step that requires verification, simply demonstrate the step to the TA or instructor. Turn in the completed verification sheet to your TA when you leave the lab. Lab Report: It is only necessary to turn in a report on Sections 5 and 6 with graphs and explanations. You are asked to label the axes of your plots and include a title for every plot. In order to keep track of plots, include your plot inlined within your report. If you are unsure about what is expected, ask the TA who will grade your report. 1 Introduction The goal of this laboratory is to gain familiarity with complex numbers and their use in representing sinu- soidal signals such as x(t) = A cos(wt + ) as complex exponentials z(t) Aejejut. The key is to use the appropriate complex amplitude together with the real part operator as follows: = x(t) = A cos(wt + p) = Re{AeÏ¢µjwt} 2 Overview Manipulating sinusoidal functions using complex exponentials turns trigonometric problems into simple arithmetic and algebra. In this lab, we first review the complex exponential signal and the phasor addition property needed for adding cosine waves. Then we will use MATLAB to make plots of phasor diagrams that show the vector addition needed when adding sinusoids. 2.1 Complex Numbers in MATLAB SP First MATLAB can be used to compute complex-valued formulas and also to display the results as vector or “phasor” diagrams. For this purpose several new MATLAB functions have been written and are available on the SP First CD-ROM. Look for the "MATLAB Files" link just below the link for this lab. Make sure that this toolbox has been installed¹ by doing help on the new M-files: zvect, zcat, ucplot, zcoords, MATLAB and zprint. Each of these functions can plot (or print) several complex numbers at once, when the input is formed into a vector of complex numbers. For example, the following function call will plot five vectors all on one graph: Toolbox zvect ( [ 1+j, j, 3-4*j, exp (j*pi), exp (2j*pi/3)]) ¹Correct installation means that the spfirst directory will be on the MATLAB path. Try help path if you need more information. McClellan, Schafer, and Yoder, Signal Processing First, ISBN 0-13-065562-7. Prentice Hall, Upper Saddle River, NJ 07458. ©2003 Pearson Education, Inc. CD-ROM Here are some of MATLAB's built-in complex number operators: conj Complex conjugate abs Magnitude angle real imag i,j X = 3+4i exp (j*theta) Angle (or phase) in radians Real part Imaginary part pre-defined as √−1 i suffix defines imaginary constant (same for j suffix) Function for the complex exponential eje Each of these functions takes a vector (or matrix) as its input argument and operates on each element of the vector. Notice that the function names mag () and phase () do not exist in MATLAB.² When unsure about a command, use help. 2.2 Sinusoid Addition Using Complex Exponentials Recall that sinusoids may be expressed as the real part of a complex exponential: x(t) = A cos (2π fot + ¢) = Re { Ae³0, :{Aci 12π fot} Þej The Phasor Addition Rule shows how to add several sinusoids: N x(t) = Σ Ak cos (2π fot + Øk) k=1 T Then the complex amplitude of the sum is N Xs = ΣXk = Açe¹Øs k=1 assuming that each sinusoid in the sum has the same frequency, fo. This sum is difficult to simplify using trigonometric identities, but it reduces to an algebraic sum of complex numbers when solved using complex exponentials. If we represent each sinusoid with its complex amplitude X = Akelok (1) (2) McClellan, Schafer, and Yoder, Signal Processing First, ISBN 0-13-065562-7. Prentice Hall, Upper Saddle River, NJ 07458. ©2003 Pearson Education, Inc. (3) (4) Based on this complex number manipulation, the Phasor Addition Rule implies that the amplitude and phase of x (t) in equation (2) are As and Øs, so x(t) = A¸ cos(2π fot + Øs) (5) We see that the sum signal x(t) in (2) and (5) is a single sinusoid that still has the same frequency, fo, and it is periodic with period To = 1/fo. ²In the latest release of MATLAB a function called phase () is defined in a rarely used toolbox; it does more or less the same thing as angle () but also attempts to add multiples of 27 when processing a vector. 2 2.3 Harmonic Sinusoids There is an important extension where x(t) is the sum of N cosine waves whose frequencies (ƒÂ) are different. If we concentrate on the case where the (fr) are all multiples of one basic frequency fo, i.e., fk = k fo (HARMONIC FREQUENCIES) then the sum of N cosine waves given by (2) becomes T Pre-Lab N N xh(t) = Σ Ak cos(2πk fot + Øk) = Re { ΣXk eÏ 2πk fot 50% {£ X6 V²+Afut} k=1 k=1 This particular signal ä(t) has the property that it is also periodic with period To = 1/fo, because each of the cosines in the sum repeats with period To. The frequency fo is called the fundamental frequency, and To is called the fundamental period. (Unlike the single frequency case, there is no phasor addition theorem here to combine the harmonic sinusoids.) 3 Do all the exercises in this section before attending the regularly scheduled lab section. 3.1 Complex Numbers This section will test your understanding of complex numbers. Use z1 = 10e-j2/3 and z2 = −5+ j5 for all parts of this section. (6) (a) Enter the complex numbers z₁ and 22 in MATLAB. Plot them with zvect () and print them with zprint (). When unsure about a command, use help. Whenever you make a plot with zvect () or zcat (), it is helpful to provide axes for reference. An x-y axis and the unit circle can be superimposed on your zvect () plot by doing the following: hold on, zcoords, ucplot, hold off (b) The function zcat () can be used to plot vectors in a "head-to-tail" format. Execute the statement zcat ( [j,-1,-2j,1]); to see how zcat () works when its input is a vector of complex num- bers. (c) Compute z₁ + z2 and plot the sum using zvect (). Then use zcat () to plot z₁ and 22 as 2 vectors head-to-tail, thus illustrating the vector sum. Use hold on to put all 3 vectors on the same plot. If you want to see the numerical value of the sum, use zprint () to display it. 21 (d) Compute 2₁22 and plot the answer using zvect () to show how the angles of the angle of the product. Use zprint () to display the result numerically. and 22 McClellan, Schafer, and Yoder, Signal Processing First, ISBN 0-13-065562-7. Prentice Hall, Upper Saddle River, NJ 07458. ©2003 Pearson Education, Inc. determine (e) Compute 22/2₁ and plot the answers using zvect () to show how the angles of 2₁ and 22 determine the angle of the quotient. Use zprint () to display the result numerically. (f) Compute the conjugate z* for both z₁ and 22 and plot the results. In MATLAB, see help conj. Display the results numerically with zprint. 3 (g) Compute the inverse 1/2 for both z₁ and 22 and plot the results. Display the results numerically with zprint. (h) Make a 2 × 2 subplot that displays the following four plots in one figure window: (i) z₁ and 22 (ii) z† and on the same plot; (iii) 1/z₁ and 1/z2 on the same plot; and (iv) 2₁22. Add a unit circle and x-y axis to each plot for reference. 3.2 ZDrill There is a complex numbers drill program called: which uses a GUI to generate complex number problems and check your answers. Go to Appendix A demos to download and run. Please spend some time with this drill since it is very useful in helping you to get a feel for complex arithmetic. M = 200; for k=1:M 3.3 Vectorization The power of MATLAB comes from its matrix-vector syntax. In most cases, loops can be replaced with vector operations because functions such as exp () and cos () are defined for vector inputs, e.g., cos (vv) = [cos (vv (1)), cos (vv (2)), cos (vv (3)), cos (vv (N))] where vv is an N-element row vector. Vectorization can be used to simplify your code. If you have the following code that plots a certain signal, x (k) = k; y (k) = cos( 0.001*pi*x (k) *x (k) ); end plot ( x, Y, 'ro-' ) zdrill then you can replace the for loop and get the same result with 3 lines of code: M = 200; y = cos (0.001*pi* (1:M) .* (1:M) ); plot (1:M, y, ro-' ) T --- make a plot of a weird signal N = 200; for k=1: N xk(k) rk (k) = sig (k) = exp (j*2*pi*rk (k)); Use this vectorization idea to write 2 or 3 lines of code that will perform the same task as the following MATLAB script without using a for loop. (Note: there is a difference between the two operations xx*xx and xx. *xx when xx is a vector.) k/50; sqrt( xk(k)*xk(k) + 2.25 ); end plot( xk, real(sig), ‘mo-’ ) McClellan, Schafer, and Yoder, Signal Processing First, ISBN 0-13-065562-7. Prentice Hall, Upper Saddle River, NJ 07458. ©2003 Pearson Education, Inc. CD-ROM Appendix A Demos ZDrill 3.4 Functions Functions are a special type of M-file that can accept inputs (matrices and vectors) and also return outputs. The keyword function must appear as the first word in the ASCII file that defines the function, and the first line of the M-file defines how the function will pass input and output arguments. The file extension must be lower case "m" as in my_func.m. See Section B.5 in Appendix B for more discussion. The following function has a few mistakes. Before looking at the correct one below, try to find these mistakes (there are at least three): matlab mfile [xx,tt] = badcos (ff, dur) %BADCOS Function to generate a cosine wave 응 응 응 응 % usage: XX = badcos (ff, dur) ff = desired frequency in Hz dur= duration of the waveform in seconds. -- gives 100 samples per period tt = 0:1/(100*ff):dur; badcos = cos (2*pi*freeq*tt); The corrected function should look something like: function [xx,tt] = goodcos (ff, dur) 0:1/ (100* ff) : dur; %-- gives 100 samples per period tt = XX = cos (2*pi*ff*tt); Notice the word "function" in the first line. Also, "freeq” has not been defined before being used. Finally, the function has "xx" as an output and hence “xx” should appear in the left-hand side of at least one assignment line within the function body. The function name is not used to hold values produced in the function. 4 Warmup: Complex Exponentials In the Pre-Lab part of this lab, you learned how to write M-files. In this section, you will write two functions that can generate sinusoids or sums of sinusoids. T 4.1 M-file to Generate a Sinusoid = Write a function that will generate a single sinusoid, x(t) A cos(wt + o), by using four input arguments: amplitude (A), frequency (w), phase (ø) and duration (dur). The function should return two outputs: the values of the sinusoidal signal (x) and corresponding times (t) at which the sinusoid values are known. Make sure that the function generates 20 values of the sinusoid per period. Call this function one_cos (). Hint: use goodcos () from part (a) as a starting point. Demonstrate that your one_cos () function works by plotting the output for the following parameters: A = 95, w = 200 rad/sec, d = π/5 radians, and dur = 0.025 seconds. Be prepared to explain to the lab instructor features on the plot that indicate how the plot has the correct period and phase. What is the expected period in millisec? Instructor Verification (separate page) 4.2 Sinusoidal Synthesis with an M-file: Different Frequencies Since we will generate many functions that are a “sum of sinusoids," it will be convenient to have a function for this operation. To be general, we will allow the frequency of each component (f) to be different. The following expressions are equivalent if we define the complex amplitudes X₁ as X₁ = Akejøk ¸ x(t) = N De{Σ Xej2π] he√ 2 + fx! } k=1 McClellan, Schafer, and Yoder, Signal Processing First, ISBN 0-13-065562-7. Prentice Hall, Upper Saddle River, NJ 07458. ©2003 Pearson Education, Inc. (7) 5See Answer
  • Q10:3. (3 points) Let ER denote a random signal that is uniformly distributed in [-1,2]. Suppose that we have observation of the following measurement: X=tanh(9)+W (5) where tanh(u) :=, and W is a random noise that has zero mean Gaussian distribution with variance one. The signal and the noise W are statistically independent. In this problem, we will obtain the linear MMSE estimator of using the observation of X. Since it is not easy to obtain the coefficients of the linear MMSE estimator analytically, we will use MATLAB simulations (or Python simulations) to approximate them. (a) Using MATLAB or Python, generate 1000 independent samples of (X, O, W); call them (21,01,w₁), (F2, 0₂, W₂) (1000, 1000, 1000). For MATLAB, you can use rand and randn functions to gener- ate independent samples of uniform random variables and Gaussian random variables respectively. Specifically, if we type >> T = 3*rand (1000, 1)-1 >> W = randn (1000, 1) MATLAB will generate a 1000-dimensional vector T consisting of 1000 i.i.d. random variables that are uniformly distributed between 1 and 2 and a 1000-dimensional vector W consisting of 1000 i.i.d. zero mean Gaussian random variables with the variance equal to one (in addition, T and W are also independent). You can use these commands to first generate (0₁, ₁), (0₂, W₂)... (1000, 1000). Then, you can use these in conjunction with the measurement equation (5) to generate #1, #2, 1000 as follows: 2ị= tanh(0) +M, ấ=1,2,..., 1000. For Python, you can use the Numpy library (please check the last page of this problem set for more information.) Use these samples to obtain the sample means, sample variance, and sample covariance as follows: = 1000-1 μx = 0₁. It. 1000 1000 1000 de,x=-1(0; – μе)(¹¡— μ¹x). (x₂ − μ^x)². 6 = – 1000 Use the above sample statistics to obtain an approximation of the linear MMSE estimator: Pappraz (2) = μ + ³x (2-x). Provide an approximation of the MSE we can achieve us- ing this estimator (provide a justification)./n(b) Using MATLAB or Python, generate another set of 1000 independent samples of (X, O,W): call them (21001, 01001, W1001), (21002, 01002, 21002) (22000, 2000, 2000). Use these samples to numerically evaluate the estimation performance of approx (-). In particular, compute the average squared estimation error: 2000 Σ (0; – Happro(ma))". in1001 Is it close to your approximation of the MSE from part (a)? 1 1000See Answer
  • Q11:1. (3 points) We will reconsider Question 4 of HW3 and investigate how the MMSE estimators we ob- tained therein actually perform using MATLAB simulations. For this question, please provide the MATLAB script you used to obtain the answers (or the Python script if you choose to use Python). Otherwise, partial or no credit will be given. First, recall the setting of Question 4 of HW3: Suppose that we want to estimate a random signal value Y N(0, 1) based on observation of a subset of the following noisy measurements: X₁ = Y + W₁, X₂=0.5Y+W₂, X3 = 5Y+W3 (1) where W₁ N(0, 1), W₂ N(0, 1), and W3 N(0, 1); Y, W₁, W₂, and W3 are independent. We can use the MATLAB command randn to create a Gaussian random variable with zero mean and variance one. For instance, if you type >> A = randn (4,1) in MATLAB, then MATLAB will generate a four by one vector A consisting of samples of four inde- pendent Gaussian random variables with zero mean and variance one (type help randn at MATLAB to see more details). And, if you subsequently type >> B = randn (4,1) 1/nthen MATLAB will generate another four by one vector B, consisting of samples of four independent Gaussian random variables with zero mean and variance one, that is independent of A. Use the randn function to generate 100 independent samples from the distribution of (Y, W₁, W₂, W3): (y(100), w (100))} (100)(100) {(y(¹), w{"), w), w), (y(²), w(²), w), w(²)), Then, generate samples of random measurements using the measurement equations as follows: for i = 1,..., 100, x = y +w{), x) = 0.5y +w₂), r = 5y + wg. Then, we can have 100 independent samples of Y, X₁, X2, and X3: {(y(¹), x{¹), x¹), x(¹), (y(²), (²), 1²), (²)), (y(100) (100) (100)(100). (100))} 100 ¡Σ(y(¹) - ÎMMSE(x,x))² w We will use these samples to evaluate the MMSE estimators we obtained in HW3. (a) Let MMSE (1, 2) denote the MMSE estimator of Y given observation of X₁ and X₂ (that you obtained in HW3). Use the generated samples of (Y, X₁, X₂, X3) to evaluate the MSE of this estimator. In particular, for i = 1,..., 100, compute the squared error (y) — ÎMMSE(TT))². Then, take the average squared error as an estimate of the MSE: 100 Σ(y¹ - ÿMMSE(x,x))² i=1 Compare this MSE with the MSE of part (a) and provide interpretation. 100 (2) (b) Let MMSE (1,3) denote the MMSE estimator of Y given observation of X₁ and X3 (that you obtained in HW3). Use the generated samples of (Y, X₁, X2, X3) to evaluate the MSE of this estimator. In particular, for i = 1,..., 100, compute the squared error (y)-MMSE(I),19)))². Then, take the average squared error as an estimate of the MSE: (3) (4)See Answer
  • Q12:4. (3 points) Suppose that X, Y, and Z are multivariate Gaussian random variables with zero means and the covariance matrix Σ = (a) Given that Y = 1 and Z this MMSE estimate. 0² OXY σχε OYZ σYX σ} 62x σαν σε -1, find an MMSE estimate of X. Compute the conditional MSE of 3 1 -1 -1 1 2 (3) (b) Given that Y + 2Z = 2, find an MMSE estimate of X. Compute the conditional MSE of this MMSE estimate.See Answer
  • Q13:3. (3 points) Suppose that [X Y Z] is a multivariate Gaussian random vector: 1 0.5 1 B-GED ~N 0.5 1 0 0 2 X (1) (a) Obtain the joint distribution of X and Z. (b) Find an MMSE estimate of X given Z = 1. What is the conditional mean squared error (MSE) of this MMSE estimate? (e) Obtain the joint distribution of X-Y and Z. Hint: note that [***]-6 #1 10 Z 0 0 (d) Find an MMSE estimate of X - Y given Z= 1. What is the conditional MSE of this estimate? (2)See Answer
  • Q14:1. (3 points) In the lectures, we discussed that px,y characterizes how much two random variables X and Y are linearly dependent on each other. In particular, the larger px,y, the more useful X is in estimating the value of Y as an affine function of X, and vice versa. In this question, we will investigate the implication of px,y taking its maximum value, i.e., px,y = 1, or -1. For simplicity, suppose that X and Y have zero means. Consider estimating the value of X as a linear function of Y, i.e., aY with some constant a. (a) Consider E[(X-aY)2] for an arbitrary real constant a. This quantity is the expected estimation error if we consider estimating the value of X as aY. It is easy to see that E[(X-aY)²] should be non-negative for any value of a. Find the value of a, denoted by a*, that minimizes E[(X-GY)²]. (Hint: E[(X-aY)²] can be written as a second order polynomial of a with its coefficients expressed in terms of the variance and covariance of X and Y.) (b) With a* found earlier, E[(X - a*Y)²] should be still non-negative. Using this fact to prove that PX, Y| ≤ 1. (c) Based on the derivations you made for earlier questions, explain what "px,y|² 1" implies regarding the relation between X and Y. (Hint: For a random variable Z, if E[Z²] = 0, then Z=0 with probability one.)See Answer
  • Q15:3. (2 points) Exercise 7.5 of [Oppenheim & Verghese]. Suppose X = 2 + V and Y = 2 V, where V is a zero-mean Gaussian random variable with the variance equal to 4. What is the covariance of X and Y? What is their correlation coefficient? Are they uncorrelated?See Answer
  • Q16:2. (3 points) Exercise 7.4 of [Oppenheim & Verghese]. The random variables X and Y have E[X] = -1, E[Y] =2, E[X²] =9, E[XY] = −4, E[Y²] = 7. (a) Let Z = 2X - Y + 5, and W = X + Y-1. Calculate the covariance zw of Z and W. (b) If X and Y are bivariate Gaussian, what is the joint density of Z and W? (Hint: Utilize the fact that affine combinations of bivariate Gaussian random variables are bivariate Gaussian.)See Answer
  • Q17:1. (2 points) Exercise 7.3 of [Oppenheim & Verghese]. (a) A random variable V is uniformly distributed in the interval [a, b]. Find its expected value µv, its second moments E[V²], and its variance of. (b) A second random variable W is independent of V but distributed identically to it. Let Y = V+W. Find the mean and variance of Y. Also determine the covariance of Y and V, and their correlation coefficient.See Answer
  • Q18:Problem 4. Common-source (Raxavi: 3.4) In Fig. 3, assume (), swing from 1V to 2.5V is required, (a) Calculate input voltages that yield V-1V and Vot-2.5V. (b) Calculate the drain current and the transconductance of M₁ in both cases. (e) How much does the small-signal gain vary as the output goes from 1V to 2.5V (this variation is called the non-linearity)? Arun Natarajan amplifier with resistive load R₂-2852, V₂-3V and A-0. If an output ECE 422/522 HW 1 Vin J VDD AD Vout Figure 3: CS amplifiers with resistive loadsSee Answer
  • Q19:Problem 3. Large-signal input vs output (Razavi:2.7) (a) Sketch Vout as a function of Vin for circuit in Fig. 2a and Fig. 2b as Vin from 0 to 3V Ignore any body-effects. Assume R₁ = 1k0. Arun Natarajan (a) a +1 VM₁ VOD Vout R₁ (a) a ECE 422/522 HW 1 +1 VM, Figure 1: Problem 2 M₁ Vinh +1 V Figure 2: Problem 3 +1.9 V (b) b +m.. Ix (b) b outSee Answer
  • Q20:Problem 2. More large-signal behavior and transconductance (Razavi:2.5) (a) Sketch Ix and the transconductance of the transistor as a function of Vx for circuits in Fig. 1a and Fig. 1b, as Vx is changed from 0 to 3V (VDD = 3V). Ignore body-effects.See Answer

TutorBin Testimonials

I found TutorBin Signal Processing homework help when I was struggling with complex concepts. Experts provided step-wise explanations and examples to help me understand concepts clearly.

Rick Jordon

5

TutorBin experts resolve your doubts without making you wait for long. Their experts are responsive & available 24/7 whenever you need Signal Processing subject guidance.

Andrea Jacobs

5

I trust TutorBin for assisting me in completing Signal Processing assignments with quality and 100% accuracy. Experts are polite, listen to my problems, and have extensive experience in their domain.

Lilian King

5

I got my Signal Processing homework done on time. My assignment is proofread and edited by professionals. Got zero plagiarism as experts developed my assignment from scratch. Feel relieved and super excited.

Joey Dip

5

TutorBin helping students around the globe

TutorBin believes that distance should never be a barrier to learning. Over 500000+ orders and 100000+ happy customers explain TutorBin has become the name that keeps learning fun in the UK, USA, Canada, Australia, Singapore, and UAE.