Question: Could you please rewrite that in this format? delay _ x = zeros ( Order + 1 , 1 ) ; % create delay line

Could you please rewrite that in this format?
delay_x = zeros(Order+1,1); %create delay line for input (x) and initialise to zero
delay_y = zeros(Order,1); %create delay line for output (x) and initialise to zero
for i=1:length(y_remaining)
for n=Order+1:-1:2
delay_x(n)= delay_x(n-1); %shift input delay line to the right by 1 sample (last sample is forgotten)
end
delay_x(1)= y_remaining(i); %insert most recent input sample at start of delay line
Accumulator =0; %zero accumulator
for n=1:Order+1%apply forward coefficients (FIR)
Accumulator = Accumulator + b(n)*delay_x(n); %b(n)*x(i-n)
end
for n=2:Order+1%apply feedback coefficients
Accumulator = Accumulator - a(n)*delay_y(n-1); %-a(n)*y(i-n-1)
end
IIR(i)= Accumulator; %output value
for n=Order:-1:2
delay_y(n)= delay_y(n-1); %shift output delay line to the right by 1 sample (last sample is forgotten)
end
delay_y(1)= Accumulator; %store latest output in delay line
end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Electrical Engineering Questions!