필터 지우기
필터 지우기

How to use cfirpm function to correct the phase of the system?

조회 수: 4 (최근 30일)
Song Shaoqin
Song Shaoqin 2023년 5월 23일
댓글: Song Shaoqin 2023년 7월 13일
I have use b = cfirpm(n,f,fresp,w) function design filters with arbitrary phase-frequency characteristics.But I don't know how to specify the phase frequency of the target in the fresp function.Is there anyone who can help?

답변 (1개)

Srivardhan
Srivardhan 2023년 7월 5일
Hi Song,
As per my understanding, you want to specify the phase frequency of the target in the fresp function.
In MATLAB, you can specify the desired phase-frequency characteristics of the target response using the ‘fresp’ argument in “cfirpm” function. The ‘fresp’ argument can be a vector or a function handle. To specify the phase-frequency characteristics using the ‘fresp’ function we need to define a function that computes the desired phase at each frequency point.
In the below code, I have used quadratic phase function f^2 as an example. We can choose any phase function. Now, “cfirmp” function will design a filter that approximately matches the desired complex frequency response at the frequency of f.
Here is the sample code for reference:
n = 64; % Filter order
f = linspace(0, 1, 1000); % Frequency vector (0 to 1)
% Define the desired phase function
phase_function = @(f) 2*pi*f.^2; % Example: Quadratic phase
% Compute the desired complex frequency response using the phase function
desired_response = exp(1j*phase_function(f));
% Design the filter using cfirpm
b = cfirpm(n, f, desired_response);
disp(b);
For further reference, please check out the links to learn more about cfirpm function.
I hope this resolves the issue you were facing.
  댓글 수: 1
Song Shaoqin
Song Shaoqin 2023년 7월 13일
I'm glad you can answer that question.
I've run you above the code:
clc
clear
n = 64; % Filter order
f = linspace(0, 1, 1000); % Frequency vector (0 to 1)
% Define the desired phase function
phase_function = @(f) 2*pi*f.^2; % Example: Quadratic phase
% Compute the desired complex frequency response using the phase function
desired_response = exp(1j*phase_function(f));
apm = abs(desired_response);
phase = angle(desired_response);
phase = unwrap(phase);
phase = phase * 180 / pi;
plot(f,apm,f,phase);
% Design the filter using cfirpm
b = cfirpm(n, f, desired_response);
% disp(b);
fvtool(b);
I find that the phase response of the filter factor b is inconsistent with the phase of desired_response.
Do you have any good suggestions?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Analog Filters에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by