Question
Period of Sinusoid: Consider a sinusoidal vector s(t) = cos(0t). You would like to display two complete cycles of the waveform s(t). The radial frequency
Period of Sinusoid: Consider a sinusoidal vector s(t) = cos(0t). You would like to display two complete cycles of the waveform s(t). The radial frequency 0 = 2 1000 radians/s, i.e. f0 = 1000 Hz or cycles/s. What is the period T0 in seconds, that is, the time required to complete one complete cycle of s(t)? How much time is needed to display two complete cycles of s(t)?
2. Time Vector: Create a time vector t in Matlab that starts at zero and ends at whatever time is required to display two complete cycles of s(t). I recommend that you make the step size between each value of t small enough that your total vector has length 100 or greater. If your step size is too large, and your time vector has only a few points, then your function s(t) will look choppy because Matlab uses a linear interpolation between adjacent points to display a discrete-time function as a continuous-time function. Do not print out the values of t.
3. Sinusoid: Now generate the vector s(t) = cos(0t + ), with 0 = 2 1000 radians/s and = 0 radians, using your time vector t. Note that you will create the vector s in Matlab, not s(t). The notation s(t) is only to indicate that s is a function of t. Matlab will not understand if you type the command s(t). The length of your sinusoid vector s should be the same length as your time vector t. Do not print out the sinusoidal vector s.
4. Plot s: Plot your sinusoid vector s (on the y-axis) versus your time vector t (on the x-axis). You should see two complete cycles of s(t). Note that because you are plotting s vs t, not 0t, your x-axis will not go from 0 to 4, because t is time and not an angle. Observe the plot but do not save it; do not print out s(t).
5. Frequency: Now increase your radial frequency 0 to 2 4000 radians/s, or f0 = 4000 Hz. Use the same time vector t as before. Recalculate s(t) = cos(0t) and plot s(t) vs t again. How many cycles of s(t) are displayed on the graph now? Answer the question in your lab report, but do not save the plot. Do not print out s(t). If you were to decrease the radial frequency 0 to 2 500 radians/s, how many cycles of s(t) would be displayed? Answer the question in your lab report but do not actually recalculate s(t).
6. Phase-Shifting: A. Change your radial frequence 0 back to the original 2 1000 radians/s. Recalculate s(t) = cos(0t). Generate a = /2 phase-shifted version of s(t) which is s1(t) = cos(0t/2). Now plot both s(t) and s1(t) (on the y-axis) vs 0t (on the x-axis) on the same graph. Note that now they are plotted EE 348: Lab 1, Spring 2018 8 vs 0t (an angle) instead of t. This is so you can observe the /2 phase shift more directly. You can plot two functions on the same graph with the command plot(omega0*t,s,b-,omega0*t,s1,r--), which plots the first function s as a blue solid line, and the second function s1 as a red dashed line. Note that the color and line style commands are optional; you could plot without specifiying them, but the different color/line styles are useful in distinguishing the functions. Do not save this plot yet, as you will add another curve to it in the next step.
7. Phase-Shifting: B. Generate a = /2 phase-shifted version of s(t) which is s2(t) = cos(0t + /2). Now plot s(t), s1(t), and s2(t) (on the y-axis) vs 0t (on the x-axis), all on the same graph. You can plot three functions on the same graph, just as you plotted two functions, with the command plot(omega0*t,s,b-,omega0*t,s1,r--,omega0*t,s2,g-.), which plots s2 as a green dash-dot line. You may find other colors and line styles with the command help plot.
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