2016-12-30 25 views
-1

我真的不明白如何繪製任意公式的傳遞函數。 Matlab文檔說要得到波特圖,我需要創建一個傳遞函數。他們舉了一個例子:tf([]),但這隻給了三級。如何在Matlab中繪製該公式的傳遞函數?

如何繪製特定公式的波特圖?

它是:。。

Y = 1./((Z0./Zl).^2 *Ĵ罪(乙 d)/ 2 + EXP(j * B * d )*(1 + Z0。/ Z1))

其中Z1,d和B是每個頻率值的向量。這是我完整的Matlab腳本。

numElem = 200; 
w = linspace(2*pi*10^8,2*pi*10^10,numElem); 
wRes = 2*pi*10^9; 

%%Insert wRes (resonant frequency) 
for n = 1:numElem 
    if w(n) > wRes 
     w = [w(1:n - 1), wRes, w(n:numElem)]; 
     resLocation = n; 
     break 
    end 
end 

freq = w ./ (2*pi); 
lambda = 299792458 ./ freq; 

%Beta 
B = pi/2 .* w ./wRes; 
B(resLocation) = pi/2; 

%Distance 
d = lambda(resLocation) ./ 4; 

Z0 = 50; %Ohms 
C = 10^(-12); 
L = 1/(wRes^2*C); 
Zl = 1 ./ (j .* w .* C + 1 ./ (j .* w .* L)); 

y = 1./((Z0./Zl).^2 .* j.*sin(B .* d)/2 + exp(j .* B .* d).*(1 + Z0 ./ Zl)) 

回答

0

我以前遇到過這個問題,它很簡單。 您的幅度20log(|數據|)和你的相位是反正切(實(數據)/ IMAG(數據)),所以你可以用下面這個公式:

Amplitude=20*log10(abs(y)); 
phase = angle(y)*180/pi; 
subplot(211) 
semilogx(freq,Amplitude) 
subplot(212) 
semilogx(frq,phase) 

結果是: enter image description here