Question

In: Electrical Engineering

In matlab using a RC low pass filter Create a 1 Hz input signal (with amplitude...

In matlab using a RC low pass filter Create a 1 Hz input signal (with amplitude of one). Corrupt the input signal with signals greater than or equal to 100 Hz and/or random noise. Use randn(length(v_in,1)) to test filter

Solutions

Expert Solution

clc
clear all


fs=2000; %sampling frequency
Ts=1/fs; %sampling time
dt=0:Ts:10-Ts; %time duration of signal
fm=1; %message signal frequency
vin=1*sin(2*pi*fm*dt); %message signal
plot(dt,vin)

%below is message signal plot

%now adding 100hz noise frequency signal in orginal signal
fn=100;
vincorrpt=vin+1*sin(2*pi*fn*dt); %corrupted or noisy message signal
figure
plot(dt,vincorrpt)

%plot of noisy corrupted signal with 100hz noise

%Now we are trying to see both signal and frequency component in frequency domain


%find length of signal
nfft=length(vin);
nfft2=2.^nextpow2(nfft);
fy=fft(vin,nfft2); %frequency domain transformation of signal
fy=fy(1:nfft2/2); %it takes out one side band from two side bands
xfft=fs.*(0:nfft2/2-1)/nfft2;
figure
plot(xfft,abs(fy/max(fy)));

%below we get plot of meggase signal in frequency domain

%kindly observe the 1 hz frequency component

nfft=length(vincorrpt);
nfft2=2.^nextpow2(nfft);
fy=fft(vincorrpt,nfft2); %frequency domain transformation of signal
fy=fy(1:nfft2/2); %it takes out one side band from two side bands
xfft=fs.*(0:nfft2/2-1)/nfft2;
figure
plot(xfft,abs(fy/max(fy)));

%Now observe below frequency spectrum shows two frequency components one at 1hz and one at 100 hz

%Now our aim is retrive our original signal of 1 hz frequrncy so we will design low pass filter of order 32
cut_off=90/fs/2; %normaalize cut off frequency
order=32;
h=fir1(order,cut_off);

con=conv(vincorrpt,h);
figure
plot(con);

%below is our filtered signal it has improved from currputed but not quite so to improve further increase order or %filter at 45

order=45;
h=fir1(order,cut_off);

con=conv(vincorrpt,h);
figure
plot(con);

Note: closely observe the above filtered figure which is close to our orginal signal Hence it is clear as we increase number of order or stages of filtering the smothens of signal improves....You can try to increase more order and see good luck


Related Solutions

a high pass rc filter can be changed to a low pass filter by
a high pass rc filter can be changed to a low pass filter by
Code in Matlab for a low pass filter and a high pass filter. Each filter must...
Code in Matlab for a low pass filter and a high pass filter. Each filter must show the frequency response (magnitude and phase) in graphs properly labelled.
Designa low-pass filter that reduces magnitude of H(jw) to 0.4 for the signal with 10(X+4)Hz. a)Use...
Designa low-pass filter that reduces magnitude of H(jw) to 0.4 for the signal with 10(X+4)Hz. a)Use 10 Ω resistor and calculate the value of the inductance of the filter. Calculate the cutoff frequency of the filter .b)Design another filter for the same purpose by using the same resistorcombined with a capacitor.Find the value of the capacitance.Find the magnitudes of H(jw) for 2Hz and 200 Hz frequencies and sketch the frequency response graph of the filter c)(20+Y)Ωresistive loadis connected across the...
Create a 2nd order Butterworth 150 Hz frequency low pass filter. Please provide transfer function and...
Create a 2nd order Butterworth 150 Hz frequency low pass filter. Please provide transfer function and frequency response. Thank you
Design an active low-pass filter with a gain of 10 and that can reject 120 Hz...
Design an active low-pass filter with a gain of 10 and that can reject 120 Hz signals. What are the parameters for this design? Please show all work. Thank you.
Design an active low pass filter with a corner frequency of 50 Hz and amplification of 10
 Design an active low pass filter with a corner frequency of 50 Hz and amplification of 10. Pick the values of the resistor and capacitor based on your own judgement to keep the cost reasonably low (simpler circuit design with less components is better).
Pass the signal x5 through the filter h using the command: x6 = filter(h,1,x5); In your...
Pass the signal x5 through the filter h using the command: x6 = filter(h,1,x5); In your report, include a plot of the amplitude spectrum of x6 (use the normalized frequency axis as you did for previous parts of this project).
4)Design a band-pass filter with a passband from 500 Hz to 2000 Hz using “butter” routine...
4)Design a band-pass filter with a passband from 500 Hz to 2000 Hz using “butter” routine of MATLAB. Assume a sampling frequency of 8KHz. Let the filter order be M=4. Plot the magnitude response and provide the filter coefficients and the transfer function
Butterworth filter a)Design a 5th order low pass Butterworth low-pass filter with a cut-off frequency of...
Butterworth filter a)Design a 5th order low pass Butterworth low-pass filter with a cut-off frequency of 1592 Hz and a dc gain of 3dB. Find and present the mathematical transfer function of the filter, showing all your steps. b) Write a Matlab code to plot the magnitude of this function with a linear scale in dB units on the ordinate, and a log scale of frequency on the abscissa. The plot range should be: ordinate- linear scale from -100dB to...
Design a bandpass active filter to pass frequencies between 700 Hz and 2100 Hz, and with...
Design a bandpass active filter to pass frequencies between 700 Hz and 2100 Hz, and with K= 63. Please include the transfer function, blot plot, multisim, and the matlab code.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT