ht2383_matlab_HW11_report

docx

School

New York University *

*We aren’t endorsed by this school

Course

6113

Subject

Electrical Engineering

Date

Feb 20, 2024

Type

docx

Pages

7

Uploaded by BarristerBoulderNarwhal28

Report
I save my code in problem1.m and problem2.m. Problem 1: Problem 1 says it’s a type1 filter, and the passband and stop-band edges are symmetric with respect to 𝜔 = 0.5pi, so I set frequency = [0 0.25 0.75 1]; % Passband and stopband edges symmetric so it can be symmetry around 0.5. It also says the weighting is equal in the pass-band and stop-band so I set weight = [1 1]; % Equal weighting in the passband and stopband . The following 3 graph are the impulse response, frequency response, phase and weighted response:
Code: % Type-I FIR Half-Band Filter Design using Remez exchange algorithm (Parks-McClellan) % Define frequency specifications
frequency = [0 0.25 0.75 1]; % Passband and stopband edges symmetric around 0.5pi amplitude = [1 1 0 0]; weight = [1 1]; % Equal weighting in the passband and stopband % Specify filter order order = 27; M = order - 1; alpha = M / 2; % Design the filter using Remez exchange algorithm h = firpm(M, frequency, amplitude, weight); % Frequency response analysis [H, weight] = freqz(h, 1, 512); weight = weight / pi; Aw = real(H .* exp(1i * pi * weight * alpha)); % Plot the impulse response figure(1); impz(h); title( 'Impulse Response' ); % Plot the frequency response figure(2); freqz(h, 1, 512); title( 'Frequency Response' ); % Plot the weighted response figure(3); plot(weight, Aw); title( 'Weighted Response' ); Problem 2: The magnitude response plot shows that the filter effectively meets the given specifications. The passband ripple (δ p ) and stopband attenuation (δ s) are within acceptable limits. The phase response plot shows the phase shift introduced by the
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
filter across different frequencies. The phase shift is generally linear within the passband. The following 4 graphs are the magnitude response, phase response, impulse response and z-plane plot of problem2:
Code: % FIR Filter Design with Given Specifications % Given specifications delta_p = 0.05; delta_s = 0.05; ws = 0.4 * pi;
wp = 0.5 * pi; % Normalize frequencies ws_normalized = ws / pi; wp_normalized = wp / pi; % Define frequency specifications frequency = [0, wp_normalized, wp_normalized+0.01, ws_normalized]; amplitude = [1, 1-delta_p, 1-delta_p, 0]; weight = [1, 1]; % Ensure frequencies are non-decreasing frequency = sort(frequency); % Specify filter order order = 30; % Design the filter using firpm h = firpm(order, frequency, amplitude, weight); % Frequency response analysis [H, w] = freqz(h, 1, 1024, 'whole' ); % Plot the magnitude response figure; plot(w/pi, abs(H)); title( 'Magnitude Response' ); xlabel( 'Normalized Frequency (\omega/\pi)' ); ylabel( '|H(e^{j\omega})|' ); % Plot the phase response figure; plot(w/pi, angle(H)); title( 'Phase Response' ); xlabel( 'Normalized Frequency (\omega/\pi)' ); ylabel( 'Phase (radians)' );
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
% Plot the impulse response figure; impz(h); title( 'Impulse Response' ); % Z-plane plot figure; zplane(h, 1); title( 'Z-plane Plot' );