简体   繁体   English

Wolfram Alpha 和 MATLAB plot 转移 function 不同

[英]Wolfram Alpha and MATLAB plot transfer function differently

I am trying to get the filter coefficients for a digital IIR filter of a simple 180° phase shift allpass filter with the transfer function: (1+s)/(1-s)我正在尝试使用传输 function: (1+s)/(1-s)获取简单 180° 相移全通滤波器的数字 IIR 滤波器的滤波器系数

This is what Wolfram gives me: Bode Plot in Wolfram这是 Wolfram 给我的: Wolfram 中的 Bode Plot

and this is what I get from MATLAB: Bode Plot in MATLAB这就是我从 MATLAB 得到的: Bode Plot in MATLAB

My code is:我的代码是:

clc; clear; close all;
z = [-1];                  %zeros
p = [1];                   %poles
k = 1;                     %gain
[num,den] = zp2tf(z,p,k);  %convert zero-pole into numerator denominator
freqz(num,den);            %bode plot

I would like to get the same plot in MATLAB as I do in Wolfram Alpha, to obtain the filter coefficients with fvtool so I can write a filter in C.我想在 MATLAB 中获得与在 Wolfram Alpha 中相同的 plot ,以使用 fvtool 获得滤波器系数,以便我可以在 Z0D61F8370CAD1D412F80B84D143E12 中编写滤波器Therefore my question is how do manage to convert the poles and zeros of the transfer function into the right format so that MATLAB does the same plot like Wolfram Alpha?因此我的问题是如何设法将传输 function 的极点和零点转换为正确的格式,以便 MATLAB 像 Wolfram 一样执行相同的 plot What am I doing wrong?我究竟做错了什么?

Your issue is that you are mixing concepts你的问题是你在混合概念

freqz is for z -based discrete frequency transforms, while you are working with s -based continuous Laplace transforms. freqz用于基于z的离散频率变换,而您正在使用基于s的连续拉普拉斯变换。 These are unequivocally not the same thing.这些显然不是一回事。

Just use the functions for continuous transforms.只需使用函数进行连续变换。

z = [-1];                  %zeros
p = [1];                   %poles
k = 1;                     %gain
[num,den] = zp2tf(z,p,k);  %convert zero-pole into numerator denominator
my_filter=tf(num,den);
bode(my_filter);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM