Question

ro A wave gauge that measures the free surface elevation at a given point was used to take data in a wave tank. Waves were ge

Program from problem 1: (Using MATLAB)

% Sampling frequency and sampling period
fs = 10000;
ts = 1/fs;
% Number of samples, assume 1000 samples
l = 1000;
t = 0:1:l-1;
t = t.*ts; % Convert the sample index into time for generation and plotting of signal
% Frequency and amplitude of the sensor
f1 = 110;
a1 = 1.0;
% Frequency and amplitude of the power grid noise
f2 = 60;
a2 = 0.7;
% Generating the sinusoidal waves
x1 = a1*sin(2*pi*f1*t); % Sensor wave
x2 = a2*sin(2*pi*f2*t); % power grid wave
% Generating the zero-mean random noise
noise = randn(1,l);
% Adding all the waves and random noise
signal = x1 + x2 + noise;
% Plotting the signal
figure,plot(t,signal)
xlabel('Time in seconds')
ylabel('Amplitude')
title('Noisy signal with 110 Hz sensor signal and 60 Hz power grid noise')
% Performing FFT on the signal
xk = fft(signal, l);
% Calculation of magnitude of the spectrum coefficients
xkabs = abs(xk);
% Plotting the single sided magnitude spectrum
f = 0:1:500;
figure,plot(f*(fs/l),xkabs(1:501))
xlabel('Frequency in Hz')
ylabel('Magnitude')
title('FFT of Noisy signal')

0 0
Add a comment Improve this question Transcribed image text
Answer #1

% Sampling frequency and sampling period
fs = 10000;
ts = 1/fs;
% Number of samples, assume 1000 samples
l = 1000;
t = 0:1:l-1;
t = t.*ts; % Convert the sample index into time for generation and plotting of signal
% Frequency and amplitude of the sensor
f1 = 110;
a1 = 1.0;
% Frequency and amplitude of the power grid noise
f2 = 60;
a2 = 0.7;
% Generating the sinusoidal waves
x1 = a1*sin(2*pi*f1*t); % Sensor wave
x2 = a2*sin(2*pi*f2*t); % power grid wave
% Generating the zero-mean random noise
noise = randn(1,l);
% Adding all the waves and random noise
signal = x1 + x2 + noise;
% Plotting the signal
figure,plot(t,signal)
xlabel('Time in seconds')
ylabel('Amplitude')
title('Noisy signal with 110 Hz sensor signal and 60 Hz power grid noise')
% Performing FFT on the signal
xk = fft(signal, l);
% Calculation of magnitude of the spectrum coefficients
xkabs = abs(xk);
% Plotting the single sided magnitude spectrum
f = 0:1:500;
figure,plot(f*(fs/l),xkabs(1:501))
xlabel('Frequency in Hz')
ylabel('Magnitude')
title('FFT of Noisy signal')

Add a comment
Know the answer?
Add Answer to:
Program from problem 1: (Using MATLAB) % Sampling frequency and sampling period fs = 10000; ts...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I wrote a Matlab program for the figure below. When I plot the waves, they look...

    I wrote a Matlab program for the figure below. When I plot the waves, they look the same. Why do the two waves frequencies look same and How do I avoid it? (I really do need this part of the question answered.) N = 200; % Total number of time domain samples in simulation. Fs = 100 ;% sampling frequency. F1 = 10; % frequency of wave - 1. F2 = 90; % frequency of wave - 2. phi =...

  • Write a MATLAB code for the question below. There is an initial signal containing 60 Hz...

    Write a MATLAB code for the question below. There is an initial signal containing 60 Hz sinusoid of amplitude 0.8 and a 150 Hz sinusoid of amplitude 1.2 corrupted by a noise - using the randn command - (zero-mean white noise with variance of 4). Plot the noisy signal in the time domain. After that compute the Fourier transform -using the fft command of the noisy signal, compute the two-sided spectrum. Define the frequency domain f and plot the single-sided...

  • Reproduce Figures 9.2b and 9.2c on MATLAB, assuming that the square wave (Figure 9.2b) is a...

    Reproduce Figures 9.2b and 9.2c on MATLAB, assuming that the square wave (Figure 9.2b) is a periodic symmetric square wave of normalized amplitude (A=1). Each student group should decide the power spectral density level of the channel noise. Compute the Fourier transform of the periodic square wave. clear all close all %%%% T=12*pi; %number of period x=linspace(0,T); t=x/pi y0=square(x); %square wave signal y0ft=fft(y0); %calculating Fourier Transformof signal y0fts=fftshift(y0ft); y0ftFinal=abs(y0ft); AWGN= rand(size(x)); %Calculating whit noise Att=(1/3); nSig= Att*AWGN; y=y0+nSig; %Square wave...

  • NB! This task is required to be solved in matlab. this task also requires the use...

    NB! This task is required to be solved in matlab. this task also requires the use of the function displayDualSpectrum(); which i have pasted in the bottom. the tasks that i need help with are A), B) and C). this is a multi-part question. Task - Frequency mixing We use a basic signal that can be described mathematically as follows: with this We shall then make an amplitude modulated signal: where fc is the carrier frequency. the code below specifies...

  • using Matlab: 1) Design an FIR notch filter using zero placement to remove power-line noise at...

    using Matlab: 1) Design an FIR notch filter using zero placement to remove power-line noise at 60 Hz (use file ecg_60hz_200, fs = 200 Hz). 2) Design a LP Butterworth filter with cut-off frequency of 40 Hz to remove high-frequency noise (use file ecg_hfn.dat, fs = 1000 Hz). 3) Design an Elliptic HP filter with passband ripple of 0.01 dB and stopband attenuation of 50 dB and cut-off frequency of 0.5 Hz to remove low-frequency noise (use file ecg_lfn.dat, fs...

  • Can you please help me answer Task 2.b? Please show all work. fs=44100; no_pts=8192; t=([0:no_pts-1]')/fs; y1=sin(2...

    Can you please help me answer Task 2.b? Please show all work. fs=44100; no_pts=8192; t=([0:no_pts-1]')/fs; y1=sin(2*pi*1000*t); figure; plot(t,y1); xlabel('t (second)') ylabel('y(t)') axis([0,.004,-1.2,1.2]) % constrain axis so you can actually see the wave sound(y1,fs); % play sound using windows driver. %% % Check the frequency domain signal. fr is the frequency vector and f1 is the magnitude of F{y1}. fr=([0:no_pts-1]')/no_pts*fs; %in Hz fr=fr(1:no_pts/2); % single-sided spectrum f1=abs(fft(y1)); % compute fft f1=f1(1:no_pts/2)/fs; %% % F is the continuous time Fourier. (See derivation...

  • (a) Determine the period, amplitude, and frequency of a signal given by, v(t) (120nt). Plot this ...

    (a) Determine the period, amplitude, and frequency of a signal given by, v(t) (120nt). Plot this signal both in the time-domain and frequency domain. (b) For the following square wave v(t), determine if it is a periodic signal, and if yes, what 10 V sin 4. [61 are its amplitude, period T and fundamental frequency f? Why do we need to convert this signal into sine/cosine wave for transmission? 2 o-oims (c) () According to Fourier Theorem, the above signal...

  • Part 1: Exponential Fourier series The following MATLAB code calculates the exponential Fourier series coefficient for...

    Part 1: Exponential Fourier series The following MATLAB code calculates the exponential Fourier series coefficient for the signal x(t) shown in the figure below, plots it's double sided amplitude spectrum IDn l, double sided phase spectrem LDn, and the resulting signal xn(t). 4r 4a Periodic signal x(t) 1.1 Show that the complex Fourier Series Coefficients written as: D 1.2 Use the following Matlab to general the two sided spectral line. 1.3 Execute the Matlab code with To = 2π and...

  • LMS project Using the notes discussed in class: Implementing the LMS Algorithm First generate some signals clear all c...

    LMS project Using the notes discussed in class: Implementing the LMS Algorithm First generate some signals clear all close al1: Generate signals for testing the LMS Algorithm 1000 Fs Sampling frequency Sample time 1/Fs 10000: = L Length of signal S Time vector (0:L-1) *T ; Sum of a 50 Hz sinusoid and a 120 Hz sinusoid 0.7 sin (2*pi*50*t); inuside X d+ 10 randn (size (t)); Sinusoids 5O0000000L plus noise fiqure (1) plot (Fs*t (1:150),x (1:1500)) title('Signal Corrupted with...

  • LMS project Using the notes discussed in class: Implementing the LMS Algorithm First generate some signals...

    LMS project Using the notes discussed in class: Implementing the LMS Algorithm First generate some signals clear all close al1: Generate signals for testing the LMS Algorithm 1000 Fs Sampling frequency Sample time 1/Fs 10000: = L Length of signal S Time vector (0:L-1) *T ; Sum of a 50 Hz sinusoid and a 120 Hz sinusoid 0.7 sin (2*pi*50*t); inuside X d+ 10 randn (size (t)); Sinusoids 5O0000000L plus noise fiqure (1) plot (Fs*t (1:150),x (1:1500)) title('Signal Corrupted with...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT