MATLAB: How to plot y(n) over the range of 0

MATLAB: How to plot y(n) over the range of 0

plotting

the conditions for y(0) =0 and y(1) =1. do i need to use while statement?

Best Answer

  • Since the limits are stated, I would just use a for loop:
    y(1) = 0;
    y(2) = 1;
    for n = 3:51
    y(n) = 1.97*y(n-1) - y(n-2);
    end
    figure(1)
    plot(0:50, y)
    grid
  • Add a Comment

    Your email address will not be published. Required fields are marked *