Question

In: Computer Science

2. Please use Matlab to generate two sine waves of 100 Hz and 10 Hz frequencies,...

2. Please use Matlab to generate two sine waves of 100 Hz and 10 Hz frequencies, respectively. Both sine waves will have a peak value of 1 (peak to peak value of 2). The sampling rate is 1000 Hz (fs = 1000 Hz) and the total data point is 1000 points for each wave. Combine the two sine waves into one. Plot the combined waveform (1 point).

Then, perform fft on the combined waveform. Plot the frequency amplitude spectrum from 1 to 0.5*fs. Make sure you label the x axis properly. (1 point).

Show the complete code (1 point).

Shorten the data point from 1000 to 100. Perform fft on the combined waveform again. Plot the result (0.5 point). Do you observe broadening in peaks (yes or no, you do not need to explain)? (0.5 point)

Solutions

Expert Solution

clc;
Fs=1000;
f1=100;
f2=10;
t=0:1/Fs:0.4;
x1=sin(2*pi*f1*t);
x2=sin(2*pi*f2*t);
x=x1+x2;
nfft=1000; % length of fft
X=fft(x,nfft); %fft calculation
X=X(1:nfft/2);
mx=abs(X); % magnitude response
f=(0:nfft/2-1)*Fs/nfft; % frequency vector
t2=0:1/Fs:.001; %discrete time vector
figure(1)
plot(t,x); %signal plot
grid on
title('Given Signal')
xlabel('Time')
ylabel('Amplitude')
figure(2)
plot(f,mx,'r')
title('Spectrum of sine wave')
xlabel('Frequency')
ylabel('Amplitude')
xlim([1,0.5*Fs])

Part 2 : When Fs=100 Hz

clc;
Fs=100;
f1=100;
f2=10;
t=0:1/Fs:0.4;
x1=sin(2*pi*f1*t);
x2=sin(2*pi*f2*t);
x=x1+x2;
nfft=1000; % length of fft
X=fft(x,nfft); %fft calculation
X=X(1:nfft/2);
mx=abs(X); % magnitude response
f=(0:nfft/2-1)*Fs/nfft; % frequency vector
t2=0:1/Fs:.001; %discrete time vector
figure(1)
plot(t,x); %signal plot
grid on
title('Given Signal')
xlabel('Time')
ylabel('Amplitude')
figure(2)
plot(f,mx,'r')
title('Spectrum of sine wave')
xlabel('Frequency')
ylabel('Amplitude')
xlim([1,0.5*Fs])

Here you can observe the broading in peaks for Fs=100 as compared to fs=1000.

The reason is as the number of samples of x(t) decrease,so the width of peaks looks broader.

Please dont downvote please


Related Solutions

1. Generate a sine wave with frequency 100 Hz. a. Sample the signal with a sampling...
1. Generate a sine wave with frequency 100 Hz. a. Sample the signal with a sampling frequency (i) 1000 Hz and (ii) 1050 Hz. b. For each frequency in Question 1(a), perform DFT for ONE (1) cycle and ONE and a HALF (1.5) cycles of the waveform. Comment on your observation.
Use the sine wave and scope in the Simulink library (MATLAB) to generate and observe the...
Use the sine wave and scope in the Simulink library (MATLAB) to generate and observe the following waves: a. ?1 (?) = sin ?? b. ?2 (?) = cos ?? c. ?2 (?) = 0.5 cos ?? d. ?3 (?) = cos (?? − ?) ? = 1 ???/s
Generate and plot sinusoids of frequencies 300 Hz, 500 Hz and 1200 Hz. Plot each of...
Generate and plot sinusoids of frequencies 300 Hz, 500 Hz and 1200 Hz. Plot each of them and their sum using the “subplot” command in one figure. Indicate the axes’ titles.
Generate a signal composed of two square waves, the first has a 14 Hz and the...
Generate a signal composed of two square waves, the first has a 14 Hz and the second has a 55 Hz frequency. Both waves are sampled at 2 kHz for 200 ms. Duty cycle for the first wave is 40% while the second’s is 35%. Show the signal with and without adding white Gaussian noise with a variance of 1/100 in matlab
If a periodic signal is decomposed into five sine waves with frequencies of 50, 300, 500,...
If a periodic signal is decomposed into five sine waves with frequencies of 50, 300, 500, 700, and 1800 GHz, what is the bandwidth? Draw the spectrum in periodic and non-periodic form, assuming components have a maximum amplitude of 5,10,1510 and 5V, express this as a function of frequency. Why can’t these spectrum be sketch as a function of time?
If a periodic signal is decomposed into five sine waves with frequencies of 50, 300, 500,...
If a periodic signal is decomposed into five sine waves with frequencies of 50, 300, 500, 700, and 1800 GHz, what is the bandwidth? Draw the spectrum in periodic and non-periodic form, assuming components have a maximum amplitude of 5,10,1510 and 5V, express this as a function of frequency. Why can’t these spectrum be sketch as a function of time?
In Matlab please part b and c 1. Generate a 1000 Hz sinusoid time sequence for...
In Matlab please part b and c 1. Generate a 1000 Hz sinusoid time sequence for 6 cycles with sampling frequency 20 kHz. Note: A sine wave with frequency fc is given by sin(2πfct). (a) Use the ‘plot’ command to display the result. (b) How many samples are present in one period of the sine wave? (c) What is the total length of the time and amplitude vectors here? I got part a: close all; clear all; clc; f_s= 16000;...
One of the harmonic frequencies of tube A with two open ends is 836 Hz. The...
One of the harmonic frequencies of tube A with two open ends is 836 Hz. The next-highest harmonic frequency is 912 Hz. (a) What harmonic frequency is next highest after the harmonic frequency 228 Hz? (b) What is the number of this next-highest harmonic? One of the harmonic frequencies of tube B with only one open end is 2940 Hz. The next-highest harmonic frequency is 3220 Hz. (c) What harmonic frequency is next highest after the harmonic frequency 3780 Hz?...
Two adjacent natural frequencies of an organ pipe are found to be 550 Hz and 650...
Two adjacent natural frequencies of an organ pipe are found to be 550 Hz and 650 Hz. a.) Calculate the fundamental frequency of the pipe. b.) Is the pipe open at both ends or open at only one end? c.) What is the length of the pipe. Please show your work and provide an answer thank you.
Question: include the MATLAB output and commands used with each problem Generate two random 10 ×...
Question: include the MATLAB output and commands used with each problem Generate two random 10 × 10 matrices with numbers between -10 and 10. This can be done with >> A = randi([-10,10],10,10) >> B = randi([-10,10],10,10) 1.     with MATLAB to determi whether A and B are invertible matrices . 2.     If A is invertible, use MATLAB to show that A-1A = I 3.     Determi whether (AB)-1 = B-1A-1 4.     Determin whether (AT)-1 = (A-1)T 5.     Determe whether (A3)-1 = (A-1)3 6.     Determi whether (A +...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT