Answered step by step
Verified Expert Solution
Question
1 Approved Answer
MATLAB 3.2 Adding Short Sinusoid to a Long Signal Vector For music synthesis, we need a way to add a short-duration sinusoid to an existing
MATLAB
3.2 Adding Short Sinusoid to a Long Signal Vector For music synthesis, we need a way to add a short-duration sinusoid to an existing long vector. For example suppose we have a MATLAB vector xLong which contains 100 elements, and we generate a sinusoid xSinus that contains 23 elements. If we want to add xSinus to xLong we cannot do xSinus+xLong because the dimensions do not match and MATLAB will report an error. Instead, we must find a 23-element subvector of xLong, and add xSinus to that subvector, e.g., xSinus+xLong (31:53) In music we must add the sinusoid at a location corresponding to a specified starting time, so we must know how to calculate the starting index of the subvector from a time (in secs). This time-to-index corre spondence could be calculated, or it could be contained in a time vector that would accompany the signal vector. In order to calculate the index, we use the sampling relationship (n-n/f.) and solve for the index n. Since the right hand side might not be an integer, in MATLAB we must round to the nearest integer (use fs = 4000 Hz in the following). nSTART = (f.)(tSTART) Generate two sinusoids both with zero phase and amplitude one. The first sinusoid should start at t 0.6 s. have a frequency of 1200 Hz and a duration of 0.5 s; the second, a frequency of 750 Hz and a duration of 1.6 seconds starting at t 0.2 s. Use a modified form of the MATLAB code frorn the pre-Lab. For verification, make a spectrogram (section length 256) of the sum signal so that you can point out features that correspond to the parameters of the sinusoids. Also, be prepared to explain the modifications you made to the MATLAB code Instructor Verification (separate 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