Matlab: z-transform of sine wave, Bode plot

  • bmalp / 200 / Wed, 24 Jun 2009 08:30:00 GMT / Comments (0)
  • Hi,
    I try to visualize a sine wave, z-transformed in a Bode plot. The frequency shows up correctly, but the amplitude is way off - why?
    Thanks for your comments.
    Bmalp

    function zdemo

    format compact
    syms w Ts n z phi t

    Ts = 1
    w = 0.1
    phi = 0

    vz = simplify(ztrans(sin(w*n*Ts+phi))) % correct

    if 0 % method 1
    [num,den] = numden(simplify(vz));
    num = collect(num,'z')
    den = collect(den,'z')
    num1 = sym2poly(num)
    den1 = sym2poly(den)
    [h,w] = freqz(num1,den1,512,'whole');
    else % method 2
    fs = 1;
    f = linspace(0,fs,256);
    w = 2*pi*f;
    ss = sqrt(-1)*w;
    Z = exp(ss/fs);
    h = double(subs(vz,z,Z));
    end
    plot(w,abs(h)) % amplitude way too big
  • Keywords:

    z-transform, sine, wave, bode, plot, matlab

  • http://programming.itags.org/matlab/66166/«« Last Thread - Next Thread »»
  • Matlab Questions

    • Access DataStore from Sfunction

      Does anyone know if it is possible for an Sfunction to get the valueof a Data Store that is not tied...

      By daveo, 1 Comments

    • Access bus signal names in S-function

      I have used a bus creator in my model to create a set of(named) signals. The output is passed to an ...

      By mick_h, 5 Comments

    • Access axes in GUI

      Hi everybody,i programmed a GUI with multiple axes to show data. The shown datasegments are refreshe...

      By basti, 2 Comments

    • access an array with this input

      Suppose I have an Nx2 array A.I want to read the elements A(5,2), A(6,1), ... and put them in anothe...

      By bahoo, 1 Comments

    • Access a variable

      Hello,This is probably a simple problem, but I was wondering how I wouldaccess a variable defined in...

      By erik_miehling, 2 Comments