Main Content

이 번역 페이지는 최신 내용을 담고 있지 않습니다. 최신 내용을 영문으로 보려면 여기를 클릭하십시오.

FVTool을 사용한 필터 분석

이 예제에서는 Signal Processing Toolbox™에서 제공하는 그래픽 사용자 인터페이스(GUI)인 필터 시각화 툴(FVTool)을 사용하여 하나의 Figure 창에서 여러 개의 필터 분석 함수를 사용하는 방법을 보여줍니다.

FVTool에는 명령줄에서 GUI와 상호 작용할 수 있는 애플리케이션 프로그래밍 인터페이스(API)도 있습니다. API를 사용하여 FVTool을 다른 응용 프로그램에 통합할 수 있습니다.

FVTool 시작하기

통과대역 주파수 0.4π rad/sample, 저지대역 주파수 0.6π rad/sample, 통과대역 리플 1dB, 저지대역 감쇠 80dB을 갖는 저역통과 필터를 생성하겠습니다. Signal Processing Toolbox의 몇 가지 필터 설계 툴을 사용하여 필터를 설계하고, 결과를 FVTool에서 분석하겠습니다.

저역통과 등리플 FIR 필터를 설계합니다.

Df1 = designfilt("lowpassfir",PassbandFrequency=0.4,...
                              StopbandFrequency=0.6,...
                              PassbandRipple=1,...
                              StopbandAttenuation=80,...
                              DesignMethod="equiripple");

저역통과 타원 IIR 필터를 설계합니다.

Df2 = designfilt("lowpassiir",PassbandFrequency=0.4,...
                              StopbandFrequency=0.6,...
                              PassbandRipple=1,...
                              StopbandAttenuation=80,...
                              DesignMethod="ellip");

필터 객체와 함께 FVTool을 실행하고, 동일한 FVTool Figure를 재사용할 수 있도록 핸들을 FVTool로 반환합니다.

hfvt = fvtool(Df1,Df2);

Figure Figure 1: Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB), xlabel Normalized Frequency ( times pi blank rad/sample), ylabel Magnitude (dB) contains 2 objects of type line.

필터 추가 및 제거하기

두 필터 모두 설계 사양을 충족하는 것을 볼 수 있습니다. 이에 더해, 체비쇼프 유형 II 설계의 성능이 얼마나 좋은지도 보고자 합니다.

addfilter 함수를 사용하여 FVTool에 필터를 추가할 수 있습니다.

Df3 = designfilt("lowpassiir",PassbandFrequency=0.4,...
                              StopbandFrequency=0.6,...
                              PassbandRipple=1,...
                              StopbandAttenuation=80,...
                              DesignMethod="cheby2");
addfilter(hfvt,Df3);

Figure Figure 1: Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB), xlabel Normalized Frequency ( times pi blank rad/sample), ylabel Magnitude (dB) contains 3 objects of type line.

플롯의 어느 선이 어느 필터에 속하는 것인지 확인하려면 FVTool 핸들의 legend 함수를 사용하여 범례를 추가할 수 있습니다.

legend(hfvt,"Equiripple","Elliptic","Chebyshev Type II");

Figure Figure 1: Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB), xlabel Normalized Frequency ( times pi blank rad/sample), ylabel Magnitude (dB) contains 3 objects of type line. These objects represent Equiripple, Elliptic, Chebyshev Type II.

deletefilter 함수를 사용하여 제거하려는 필터의 인덱스를 전달하여 FVTool에서 필터를 제거할 수 있습니다.

deletefilter(hfvt,[1 3]);

Figure Figure 1: Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB), xlabel Normalized Frequency ( times pi blank rad/sample), ylabel Magnitude (dB) contains an object of type line. This object represents Elliptic.

분석 파라미터 변경하기

FVTool에서 반환하는 핸들은 필터 및 현재 분석과 상호 작용할 수 있도록 지원하는 속성을 포함합니다. 사용 가능한 모든 속성을 보려면 get 명령을 사용하십시오. FVTool 특정 속성인 마지막 14개 속성을 표시합니다.

s = get(hfvt);

Figure Figure 1: Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB), xlabel Normalized Frequency ( times pi blank rad/sample), ylabel Magnitude (dB) contains an object of type line. This object represents Elliptic.

% Keep the last 14 properties
c = struct2cell(s);
f = fieldnames(s);
s = cell2struct(c(end-14:end),f(end-14:end),1)
s = struct with fields:
       SelectionHighlight: on
                      Tag: 'filtervisualizationtool'
                 UserData: []
                  Visible: on
                 Analysis: 'magnitude'
           NumberofPoints: 8192
           FrequencyRange: '[0, pi)'
    NormalizeMagnitudeto1: 'off'
        OverlayedAnalysis: ''
           FrequencyScale: 'Linear'
          FrequencyVector: [0 0.0039 0.0078 0.0118 0.0157 0.0196 0.0235 0.0275 0.0314 0.0353 0.0392 0.0431 0.0471 0.0510 0.0549 0.0588 0.0627 0.0667 0.0706 0.0745 0.0784 0.0824 0.0863 0.0902 0.0941 0.0980 0.1020 0.1059 0.1098 0.1137 ... ] (1x256 double)
         MagnitudeDisplay: 'Magnitude (dB)'
      NormalizedFrequency: 'on'
            PolyphaseView: 'off'
            ShowReference: 'on'

FVTool 분석 파라미터 대화 상자에서 사용 가능한 모든 파라미터는 FVTool 객체의 속성으로도 사용할 수 있습니다. 2개의 입력 인수만 사용하여 set 명령을 사용하면 가능한 모든 값이 반환됩니다.

set(hfvt,"MagnitudeDisplay")
ans = 1x4 cell
    {'Magnitude'}    {'Magnitude (dB)'}    {'Magnitude squared'}    {'Zero-phase'}

디스플레이를 Magnitude Squared로 설정합니다.

hfvt.MagnitudeDisplay = "Magnitude Squared";

Figure Figure 1: Magnitude Response (squared) contains an axes object. The axes object with title Magnitude Response (squared), xlabel Normalized Frequency ( times pi blank rad/sample), ylabel Magnitude squared contains an object of type line. This object represents Elliptic.

Analysis 속성의 가능한 모든 값을 가져옵니다.

set(hfvt,"Analysis")
ans = 1x12 cell
    {'magnitude'}    {'phase'}    {'freq'}    {'grpdelay'}    {'phasedelay'}    {'impulse'}    {'step'}    {'polezero'}    {'coefficients'}    {'info'}    {'magestimate'}    {'noisepower'}

이번에는 분석을 변경하여 필터의 군지연 응답을 살펴보겠습니다. 디폴트 단위를 표시합니다.

hfvt.Analysis = "grpdelay";

Figure Figure 1: Group delay contains an axes object. The axes object with title Group delay, xlabel Normalized Frequency ( times pi blank rad/sample), ylabel Group delay (in samples) contains an object of type line. This object represents Elliptic.

GroupDelayUnits = hfvt.GroupDelayUnits
GroupDelayUnits = 
'Samples'

두 분석 겹쳐 놓기

군지연 응답과 크기 응답이 주파수 영역에서 어떻게 겹쳐지는지도 살펴보고자 합니다.

FVTool에서 공통된 x축(시간 또는 주파수)을 공유하는 임의의 두 분석은 OverlayedAnalysis 속성을 설정하여 겹칠 수 있습니다.

set(hfvt,OverlayedAnalysis="magnitude",Legend="On")

Figure Figure 1: Group delay and Magnitude Response (dB) contains an axes object. The axes object with title Group delay and Magnitude Response (dB), xlabel Normalized Frequency ( times pi blank rad/sample), ylabel Group delay (in samples) contains an object of type line. This object represents Elliptic: Group delay.

겹쳐 보는 분석을 비활성화하려면 OverlayedAnalysis 속성을 ''로 설정하면 됩니다.

hfvt.OverlayedAnalysis = '';

Figure Figure 1: Group delay contains an axes object. The axes object with title Group delay, xlabel Normalized Frequency ( times pi blank rad/sample), ylabel Group delay (in samples) contains an object of type line. This object represents Elliptic.

FVTool 핸들에서 close 함수를 호출하면 FVTool Figure를 닫을 수 있습니다.

close(hfvt)

참고 항목

|