Errors in digital notch filter function block .
Show older comments
How do i remove all those errors.? Any fast response really appreciated!
function filter_output = fcn(input_current, sample_instant)
persistent x_t1 y_t1 y_t2 y_t x_t2;
%persistent value are equivalent to the static variable
%initialization of persistent variables to zero value. if isempty(x_t1)
x_t1=0;
end
if isempty(x_t2)
x_t2=0;
end
if isempty(y_t1)
y_t1=0;
end
if isempty(y_t)
y_t=0;
end
if isempty(y_t2)
y_t2=0;
end
if (sample_instant == 0)
y_t = (0.9975*x_t2-1.9911*x_t1+0.9975*input_current-0.9950*y_t2+1.9911*y_t1);
y_t2 = y_t1;
y_t1 = y_t;
x_t2 = x_t1;
x_t1 = input_current;
end
end
Answers (0)
Categories
Find more on Modeling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!