write comments for each line of the matlab code and explain
. I need explanation in each line
clear all; |
|
close all; |
|
load nb2_noise_data.mat; |
|
fs = 1000; |
|
N = 256; |
|
fl1 = 170; |
|
fh1 = 230; |
|
fl2 = 370; |
|
fh2 = 430; |
|
f = [0, fl1, fl1, fh1, fh1, fl2, fl2, fh2, fh2, fs/2] /(fs/2); |
|
G = [0, 0 ,1 , 1 , 0, 0, 1, 1, 0 , 0 ]; |
|
figure; |
|
plot(f*(fs/2),G); |
|
[b,a] = yulewalk(12,f,G); |
|
X = filtfilt(b,a,x); |
|
f = (0:N-1) * fs / N; |
|
H_before = abs(fft(x,N)); |
|
H_after = abs(fft(X,N)); |
|
figure; |
|
subplot(2,1,1); |
|
plot(f(1:N/2), H_before(1:N/2)); |
|
subplot(2,1,2); |
|
plot(f(1:N/2), H_after(1:N/2)); |
clear all;/ clear all variables from workspace or memory |
|
close all;/ close all preexisting figures |
|
load nb2_noise_data.mat;/load particular file variables into workspace |
|
fs = 1000;/ define value |
|
N = 256;/ define value |
|
fl1 = 170;/define value |
|
fh1 = 230;/define value |
|
fl2 = 370; |
|
fh2 = 430; |
|
f = [0, fl1, fl1, fh1, fh1, fl2, fl2, fh2, fh2, fs/2] /(fs/2);/define matrix of all the earlier defined notation |
|
G = [0, 0 ,1 , 1 , 0, 0, 1, 1, 0 , 0 ];/another matrix G defined |
|
figure;/to get figures plot of later function |
|
plot(f*(fs/2),G);/plot the figure between f*(fs/2) on Y-axis and G on X-axis |
|
[b,a] = yulewalk(12,f,G);/return the recursive digital IIR filter of 12 order |
|
X = filtfilt(b,a,x);/zero phase digital filtering with input x |
|
f = (0:N-1) * fs / N;/ calculate values of 'f' as defined function |
|
H_before = abs(fft(x,N));/absolute normal value of N point fft |
|
H_after = abs(fft(X,N));/absolute normal value of N point fft |
|
figure;/plot a figure |
|
subplot(2,1,1);/location of plot described as 2×1 matrix in first location (make a 2×1 grid and at first place plot the figure) |
|
plot(f(1:N/2), H_before(1:N/2));/plot f versus of H_before on X-axis |
|
subplot(2,1,2);/ plot figure at secons position in 2×1 gridor matrix |
|
plot(f(1:N/2), H_after(1:N/2));/plot f vs H_after on X-axis |
write comments for each line of the matlab code and explain . I need explanation in...
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 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...
Below is the MATLAB code of low-cut shelving filter which can cut the low frequency of given music signal and low-boost shelving filter which can boost the low frequency of given music signal. Design your low-boost shelving filter and low-cut shelving filter to have noticeablly different sound. Compare the sounds of two music signals after filtering, and explain the difference in sounds briefly. If there are any mistakes in code, correct them. Low-cut shelving filter code: close all, clear all,...
This is a MATLAB Question. Below is my base code for a Fourier
Series of a half triangle wave.
So I am being asked to isolate the first 8 components so that
only those first 8 components of the half triangle function are
calculated by MATLAB fft function, and then afterwards I am asked
to do the same thing but with the first 20 components rather than
the first 8. How do I isolate the first x number of components...
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...
please help me with this MATLAB CODE and
explain to me what each line does and what is used for?
leave your comments as words, not as pictures.
.....................................................................................................................................................................
clear all; close all; % For a script file, you better start with
clear all and close all
% However, for a fucntion, you better NOT to start
% with them
%% End of cell mode example
%% Plot function
t = 0:0.1:5;
x1 = sin(2*5*t); x2 = cos(3*7*t);...
Exercise 4. Computing and displaying the Fourier Transform of a signal Later in the semester it will become useful to determine the frequency response of a signal or system by taking the Fourier Transform empirically (rather than computing it analytically). To do so we make use of the fft and fftshift commands. The fft command is an efficient implementation of the Discrete Fourier Transform (DFT) known as the Fast Fourier Transform (FFT). When the FFT is computed the samples are...
I need help in MATLAB. I'm working on a circuits lab report and I want to plot the derivative of an input signal. The circuit is a differentiator OpAmp. It is receiving a triangle wave as an input and should output a square wave. (I've included my existing code.) The output formula is: Vout = -(Rf)*C*(dVin/dt) Where Rf is feedback resistance: Rf = 1*10^6; and C = 1*10^-6. EXISTING CODE: %% This section is copied, and then modified from another...
why the error comes
100% E52 Wed 7:41 AM MATLAB R2016a g (CHUNG HA)-"Snap... EDITOR PUBLISH VIEW Close on S+one www.youtube.com insert Efx P Recommended: Stone Musl... Settings ment Breakpoints Run Run and Advance Run and ndent Advance Time LDIT BREAKPOINTS RUN ents MATLAB Editor /Users/xinyuli/Documents/MATLAB/EMEC 5671Assign2.m EMEC 5671Assign2.m bisect.m W4 + 117 118 W5.Duffing's oscillator function dxedxdt (t,x) 119 120 121 dx(1,1)x(2,1); dx(2,1)-e.25x (2,1)+x(1,1)-x(1,1)^3+0.3*cos (t) ; 122. 123- 124 125 end tspan [e 60]; xe [e;11 It,x]-ode45(@dxdt, tspan, x0)...
I need help with number 2 . Please answer in MATLAB thank
you!
1. In the lab we analyzed filtering 60 Hz power-line noise from ECG signal using a digital (signal processing) filter. Now let's try to an analog (circuit) filter approach to remove the 60 Hz line-noise. Following is an active twin-T notch filter with transfer function: (1+m)((2joRC? +1 Z(a) 2R 2R Here m is the ratio of the two feedback 2C R resistance which determines the gain and...