Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Why this Matlab code not work

Status
Not open for further replies.

garimella

Full Member level 5
Joined
Aug 25, 2011
Messages
260
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Activity points
3,276
I have an array(arry(k)) that contains the sampled waveform. All that I am trying to do is to subject the array data to 2nd order IIR HPF and store the result in another array. But I am getting error when running the matlab code. What could be the problem?

Code:
b0=0.9693;
b1=-1.9386;
b2=0.9693;
a1=-1.9381;
a2=0.9390;

for k=1:16
y=b0*arry(k)+b1*x1+b2*x2-a1*y1-a2*y2;
y1=y;
y2=y1;
x2=x1;
x1=arry(k);
filt_arry(k)=y;    
end

error:
Undefined function or variable 'x1'.
 

You are using the 'x1' variable whth no previous assignment.
Provide an initial value prior getting in the for...end loop
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top