Prev: ARQ simulation
Next: FTDI and matlab
From: Diana Saleh on 23 Jun 2008 06:30 Hi, i know this problem have been discussed before, but i still cant figure out my problem base on previous discussion. I have this simple function: function [yq] = hipassq (x,N,w,x_1,y_1) % Writing different equations for the transfer function H(z) = 1/(z+o.5). % This MATLAB function here is for the quantized different equations. % x : input sequence % y : output sequence % N : number of output values % w : word length (bit) % initialising q = 2^(-w+1); x_1q = q*round(x_1/q); y_1q = q*round(y_1/q); a_1q = q*round(0.5/q); y_1q = x_1q - 0.5*y_1q; y(1) = q*round(y_1q/q); for n = 2:N yq(n) = x(n-1) - a_1q*y(n-1); end As I run this program in MATLAB, this error occured: ??? Attempted to access y(2); index out of bounds because numel(y)=1. Error in ==> hipassq at 16 yq(n) = x(n-1) - 0.5*y(n-1); Can anyone help me please? Thank you =)
From: us on 23 Jun 2008 06:37 "Diana Saleh": <SNIP down to possible typo... > for n = 2:N > yq(n) = x(n-1) - a_1q*y(n-1); > end should probably(!) read y(n) = x(n-1) - a_1q*y(n-1); us
|
Pages: 1 Prev: ARQ simulation Next: FTDI and matlab |