Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Page of 8 ZOOM + The instructor verilication sheet may be found at the end of this lab. 3.1 Generating Beat Signals in MATLAB A
Page of 8 ZOOM + The instructor verilication sheet may be found at the end of this lab. 3.1 Generating Beat Signals in MATLAB A beat signal is defined by five parameters {B, fc fa, PcPA } as shown in Section 2.2, equation 3. Alternatively, it can be defined using the five parameters {4, f1, f2,41,42} as shown in equation 4. For the product form from equation 3, we can store the parameters in a MATLAB structure that has seven fields (by including start and end times), as shown in the following template. In addition, we can calculate and store the parameters for the sum form and store them in the same structure. sigBeat. Amp = 10; %-- B in Equation (3) sigBeat.fc = 480; %-- center frequency in Eq. (3) sigBeat.phic = 0; %-- phase of 2nd sinusoid in Eq. (3) sigBeat. fDelt - 20; %-- modulating frequency in Eq. (3) sigBeat.phiDelt = -2*pi/3; %-- phase of 1st sinusoid Eq. (3) sigBeat.t1 - 1.1; %-- starting time sigBeat.t2 = 5.2; %-- ending time % %----- extra fields for the parameters in Equation (4) % sigBeat.fi %-- frequencies in Equation (4) sigBeat.f2 %-- sigBeat.X1 %-- complex amps for sinusoids in Equation (4) sigBeat.X2 %-- derived from A's and phi's % sigBeat values %-- vector of signal values sigBeat.times %-- vector of corresponding times Sif the second argument of spectrogram is made equal to the "empty matrix" then the default value used, which is the maximum of 256 and the signal length divided by 8. Usually the window (section) length is chosen to be a power of two, because a special algorithm called the FFT is used in the computation. The fastest FFT programs are those where the FFT length is a power of 2. Page of 8 ZOOM + (a) Write a MATLAB function that will initialize a sigBeat structure given the product values (from equation 3) and will also calculate the extra field values shown above, corresponding to the sum form in equation 4. Use the template below: function sigBeat = makeBeatStruct( B, fc, fdelta, phasel, phase2, startTime, endTime ) % %--- Create a structure that has all the parameters defining a beat signal as used % in Equations (3) and (4) (b) Produce beat signals with two frequency components: one at 570 Hz and the other at 610 Hz. Use a duration of about 10 seconds to hear the beat frequency sound. (a) Your code should accept the parameters as stored in sigBeat. (b) Your code should create two separate beat signals, one using equation 3 and one using equation 4. (Both should be identical.) (c) Use the feature discussed in Section 2.6 to generate a spectrogram plot of the beat signal here. Demonstrate the plot and sound to your lab instructor or TA. Instructor Verification (separate page) Moto Fraunau Function ZOOM + Page of 8 ZOOM + The instructor verilication sheet may be found at the end of this lab. 3.1 Generating Beat Signals in MATLAB A beat signal is defined by five parameters {B, fc fa, PcPA } as shown in Section 2.2, equation 3. Alternatively, it can be defined using the five parameters {4, f1, f2,41,42} as shown in equation 4. For the product form from equation 3, we can store the parameters in a MATLAB structure that has seven fields (by including start and end times), as shown in the following template. In addition, we can calculate and store the parameters for the sum form and store them in the same structure. sigBeat. Amp = 10; %-- B in Equation (3) sigBeat.fc = 480; %-- center frequency in Eq. (3) sigBeat.phic = 0; %-- phase of 2nd sinusoid in Eq. (3) sigBeat. fDelt - 20; %-- modulating frequency in Eq. (3) sigBeat.phiDelt = -2*pi/3; %-- phase of 1st sinusoid Eq. (3) sigBeat.t1 - 1.1; %-- starting time sigBeat.t2 = 5.2; %-- ending time % %----- extra fields for the parameters in Equation (4) % sigBeat.fi %-- frequencies in Equation (4) sigBeat.f2 %-- sigBeat.X1 %-- complex amps for sinusoids in Equation (4) sigBeat.X2 %-- derived from A's and phi's % sigBeat values %-- vector of signal values sigBeat.times %-- vector of corresponding times Sif the second argument of spectrogram is made equal to the "empty matrix" then the default value used, which is the maximum of 256 and the signal length divided by 8. Usually the window (section) length is chosen to be a power of two, because a special algorithm called the FFT is used in the computation. The fastest FFT programs are those where the FFT length is a power of 2. Page of 8 ZOOM + (a) Write a MATLAB function that will initialize a sigBeat structure given the product values (from equation 3) and will also calculate the extra field values shown above, corresponding to the sum form in equation 4. Use the template below: function sigBeat = makeBeatStruct( B, fc, fdelta, phasel, phase2, startTime, endTime ) % %--- Create a structure that has all the parameters defining a beat signal as used % in Equations (3) and (4) (b) Produce beat signals with two frequency components: one at 570 Hz and the other at 610 Hz. Use a duration of about 10 seconds to hear the beat frequency sound. (a) Your code should accept the parameters as stored in sigBeat. (b) Your code should create two separate beat signals, one using equation 3 and one using equation 4. (Both should be identical.) (c) Use the feature discussed in Section 2.6 to generate a spectrogram plot of the beat signal here. Demonstrate the plot and sound to your lab instructor or TA. Instructor Verification (separate page) Moto Fraunau Function ZOOM + Page
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started