Sine_Loop is below
Where a blank is shown you must use correct English and simple statements to convey your answer. 10 points.
Open the Matlab file Sine_Loop in Blackboard. Save it to Documents\Matlab folder.
1. What is the last value of the output variable ‘result’______________?
2. How many sine waves are produced by this Matlab routine _______? What do they look like? Describe them in one sentence (If you write 2 sentences, no credit is given)_____________________________________________________________________________ _______________________________________________________________________.
3. What happens when line 5 is executed? ______________________________________________________________________________ _________________________________________________________________________?
4. In MATLAB, a for loop begins with the statement indicating how many times the statements in the loop will be executed. This statement is called a _____________. The _____________ will be incremented by a specific value until its final value is reached (stop value). Therefore, the loop will be executed the number of times according to the ____________.
5. Circle the correct answer and fill in the blank: When I look at the plots, the I see the waveform’s amplitude does or does not change while the _________________ changes as each note is played.
Sine_Loop File code
1. A = 4;
2. samplerate=4000 %needs to be less than half of the frequency, F
3. for F = 100:100:300 %three frequencies
4. t = 0:1/samplerate:0.1; %this is the time variable
5. result = A*sin(2*pi*F*t) %compute result by the sine function (the loop will compute 3 results)
6. plot(2*pi*F*t,result)%plot the result on the y axis and time on x-axis
7. xlabel('time(s)');%label the x-axis
8. ylabel('Amplitude (units)'); %naming axis
9. sound(result,samplerate); %sounding the output signal at a sample rate of 8000 Hertz
10. pause(3); %pause between each loop
11. % the loop and sine wave computation keeps going for each Frequency
12. % 100, 200, 300
13. end %ending of loop