Question

In: Electrical Engineering

Matlab Code that does the following: Takes as input 3 frequencies. Create a signal that is...

Matlab Code that does the following:

Takes as input 3 frequencies.

Create a signal that is a mixture of the 3 signals. Create a bandpass filter that only selects the center

frequency.

Output the filtered signal which contains only the middle frequency.

Plot in time and frequency domain the original signal and the filtered signal. Show the output for filter

order 1 and 15. Upload a pdf of the image files. Each figure should have your name in the title of the

submission.

Solutions

Expert Solution

clc
clear all
close all
fs = 600;
t = 0:1/fs:.5;
N=10;
x = sin(2*pi*50*t)+sin(2*pi*150*t)+sin(2*pi*250*t);
d=fdesign.bandpass('N,F3dB1,F3dB2',N,100,200,fs);
Hd=design(d,'butter');
y=filter(Hd,x);
subplot(2,1,1)
plot(t,x)
title('Input signal')
xlabel('time')
ylabel('Amplitude')
subplot(2,1,2)
plot(t,y,'-r')
title('Filtered signal')
xlabel('time')
ylabel('Amplitude')

figure;
freq=0:(2*pi)/length(x):pi;
X=fft(x);
Y=fft(y);
plot(freq,abs(X(1:length(x)/2+1)))
hold on
plot(freq,abs(Y(1:length(x)/2+1)),'-r')
hold off
xlabel('Normalized Frequency (\times\pi rad/sample)')
legend('Original Signal','Bandpass Signal')
title(['Frequency Response of input and filtered signal for order N=',num2str(N)])

For N=10;

For N=1;

In the title you can add your name. Change N value to change the order which will give you corresponding plot.


Related Solutions

Write a Matlab function called “SimpleChannel” which takes a signal as an input, simulates a channel...
Write a Matlab function called “SimpleChannel” which takes a signal as an input, simulates a channel and returns the transmitted signal.. SimpleChannel function will add a randomly generated noise (look for “rand” function) to the signal and return it. You can adjust the amplitude of the noise as you want in order to have a distinct noise effect. Then write another matlab code to show the channel noise. First create the signal and then simulate the channel by using your...
MATLAB Write a code that takes the initial velocity and angle as an input and outputs...
MATLAB Write a code that takes the initial velocity and angle as an input and outputs the maximum height of the projectile and its air time. Follow the pseudo code below. This will not be provided in as much detail in the future so you’ll have to provide pseudocode or a flowchart to showcase your logic. For this first assignment though, the logic is laid out below with some indented more detailed instructions. PROGRAM Trajectory: Establish the User Interface (Typically...
Matlab Create/write a function that takes an input of x and y data, and a string...
Matlab Create/write a function that takes an input of x and y data, and a string (either linear? or quadratic), sets up a linear system of equations (Ax = b), and solves and plots the model.
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
Write a recursive function (using Matlab) moreFactors(a,b,fact) that does the following: 1. Takes as an input...
Write a recursive function (using Matlab) moreFactors(a,b,fact) that does the following: 1. Takes as an input 3 positive integers. 2. Of the two integers a and b, the function returns the integer that has the most factors fact. 3. If both integers a and b have the same amount of factors fact, the function will return the larger integer. Test your function with the following: >> result=moreFactors(24,32,3) result = 24 (24 = 3^1 · 2^3 , 32 = 2^5 )...
This is a Matlab Exercise problem. Please create the Matlab code and figure for the following...
This is a Matlab Exercise problem. Please create the Matlab code and figure for the following problem using problem specifications: Plot x vs y when y=sin(x), y=cos(x), y=sin (2*x), and y=2*sin(x) when x = 1:0.1:10. Use 2 by 2 subplot, sin(x) is in location 1, cos(x) is in location 2, sin(2*x) is in location 3 and 2*sin(x) is in location 4. The plot should have: (1) x label = ‘x value’, y label = ‘y value’, legend ‘y=sin(x)’,’ y=cos(x)’,’ y=sin...
In MATLAB; 3- Plot a 8V-2KHZ Sine signal in MATLAB. While this signal varies between C...
In MATLAB; 3- Plot a 8V-2KHZ Sine signal in MATLAB. While this signal varies between C = 10uF-100uF in 1uF steps for your application to the serialRLC circuit, calculate the L values ​​for R = 50 Ohm (constant) that can pass the maximum current through the circuit and write to the file. Plot the change graph of the L value calculated according to each C value.
I need to create a servlet that takes in an input that will do the following...
I need to create a servlet that takes in an input that will do the following calculations. If the input number is a prime, just output a message showing that it is a prime; If the input number is not a prime and it is an odd integer, write it as a product of two smaller odd integers; If the input number is not a prime and it is an even integer, first extract the largest power of 2, then...
Need explanation of MATLAB code which creates echo. (SIGNAL PROCESSING) If the original audio signal is...
Need explanation of MATLAB code which creates echo. (SIGNAL PROCESSING) If the original audio signal is x(t) then the echo is y(t) = x(t) + alpha*x(t-delay) This code below creates this echo however I don't understand how every line of the code works, could someone comment this code so I can understand? [x,Fs] = audioread('Hallelujah.wav'); sound(x,Fs); delay = 0.5; % 0.5s delay alpha = 0.65; % echo strength D = delay*Fs; y = zeros(size(x)); y(1:D) = x(1:D); for i=D+1:length(x) y(i)...
Make the following matlab function. D=inverses(A) It takes the input of an nxn matrixA. First, the...
Make the following matlab function. D=inverses(A) It takes the input of an nxn matrixA. First, the function has to determine whether A is invertible (you may want to use the function rank to do that). If A is not invertible, the function has to return an empty matrix D=[ ]; and terminates with a message “Matrix A is not invertible”. If A is invertible, then the function reduces the matrix [A eye(n)] into the reduced echelon form and returns the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT