Unable to view filter output on scope

Hello,
I am new to Scilab Xcos and am finding it difficult to resolve this issue.

Issue: I have a sine wave generated using SINBLK_f which is connected to a scifunc_block_m block. The sine wave generated is the input to the scifunc_block_m block. Within the block, the piece of code written is

function [y] = myFIRFilter(u)
    h = [1, -1, 1];
    y = filter(h, 1, u);
endfunction

This block is inturn connected to scope to view the output. But the scope displays the input sine wave without filtering the signal. How to check if the obtained result is right or not?

Similarly, another function block with the given code was tried:

function [y] = myFIRFilter()
    x = [1, 2, 3, 4, 5, 6];
    h = [1, -1, 1];
    y = filter(h, 1, x);
endfunction

But the output could not be viewed on the scope and there was an error stating the return value of the variable is incorrect.

It would be very helpful if anyone knows how to resolve the error and could help me with this problem. Thank you in advance.

1 Like