Question: Procedure 1. Prepare and run a simple MATLAB script: sin60hz.m. Invoke MATLAB program Open a new m-file Save it as sin60hz.m Copy the following statements
Procedure
1. Prepare and run a simple MATLAB script: sin60hz.m.
Invoke MATLAB program
Open a new m-file
Save it as sin60hz.m
Copy the following statements into the M-file editor screen, and save it again.
Copy the statements into MATLAB running window, and hit Enter key to run script
Observe running results and answer the following questions.
Question 1.
How many sine waves are generated?
What is the sampling time? How to find the size of time vector (how many elements) using a MATLAB function?
Explain the meaning of stem(e(1:30)).
%Program: sin60hz.m
% Description: This m file generates a 1.414Vpp 60Hz sine wave
% and plots
clear;
clf;
t = 0:0.001:1; % Time vector
e = sin(2*pi*60*t);
figure(1), stem(e(1:30));
figure(2), stem(e(1:30)), grid on;
figure(3), plot(t,e), grid on,
figure(4), plot(t(1:50),e(1:50)), grid on;
figure(5), plot(t(1:100),e(1:100)), grid on;
2. Prepare and run a simple MATLAB script: sincos30_60hz.m.
Prepare a second M-file called sincos30_60Hz that contains the following statements.
Run the script by typing sincos30_60hz.m and observe the results
Question 2:
What is the period of the resultant plotted signal?
Verify by hand that the Stem() and Plot() results are correct.
clear;
clf;
t = 0:0.001:1; % Time vector
f1 = 30;
f2 = 60;
e = sin(2*pi*f1*t)+ cos(2*pi*f2*t);
figure(1), stem(e(1:30));
figure(2), plot(e(1:100)), grid on;
3. Prepare and run the script fourier.m for approximating a square wave and
Observe the output.
Write a MATLAB program to generate signal waveforms using the equations listed below, for up to 7th harmonics. And make plots of the resulting signals with appropriate x-axis and y-axis information. We assume that the
Fundamental signal frequency f1 = 60 Hz, w1 = 2pf1, T = 1/f1
Amplitude A = 5 volts
Sampling frequency Fs = 10K Hz, Ts = 1/Fs
Signal starting time 0 sec, and ending time 40 ms
Square wave:
Question 3:
What is the highest order of harmonic that appear in the x_sq(t) equation?
What is the sampling time defined for x_sq(t) signal?
Is the sampling frequency Fs = 10E3 Hz satisfies the Nyquist Theorem for signal reconstruction?
Change Fs to 10Hz, 100Hz, 1000Hz and report your findings. Does the sampling frequency satisfy the Nyquist Theorem for signal reconstruction?
Extend x_sq(t) to include 9th (positive term) and 11th (negative terms) harmonics. Compare this result with the given one.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
