ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Troubles with Initial Conditions

Hi,

 

I'm trying to recreate the filter function, with initial conditions, from matlab to LabView. I have the correct Initial conditions as an array like ([   -0.6735,1.3470, -0.6735]) but  the IIR Filter wit I.C.vi needs a X initial conditions and Y initial condition.. What that it means? How can I transform my single array of IC to thes two inputs? If I can't, there is a way to know how the vi works to prepare my signal before and obtain the same results as matlab?

Without the IC the vi works perfectly...

 

Thanks!

0 Kudos
Message 1 of 3
(3,373 Views)

Having trouble picturing what your code looks like. Could you post it, or a picture of it?

0 Kudos
Message 2 of 3
(3,322 Views)

The code from matlab is:

       [b,a] = butter(3,0.125,'high')

       Fz = filtfilt(b,a, x)

Where x is a my signal with length = 15.

In the filtfilt code, that can be found here:http://www.mathworks.com/matlabcentral/fileexchange/12886-teqcspec/content/Teqcspec/filtfilt.m , the initial conditions are calculated and stored in "zi", if you follow the code you will obtain as result: 

zi =
   -0.6735
    1.3470
   -0.6735

If you keep goind with the code, x is expanded and stored on Y. And the initial conditions are multiplied for y(1).

zi * y(1)

ans =

   -2706.8
    5413.6
   -2706.8

 

This are my initial condition, as I said in my previous post, obtain b, a, zi are not a problem, I have that handled.

The problem remains when I try to implement the filter function, without I.C. the results are the same. but when I want to use my I.C. LabView wants two array, X and Y, as I.C.

I tried to use only X, only Y, use the same values for X and Y... and no result.

Attached I left the .vi and a the sample values for X. The sample values are extended, so you can skip that part.

 

Thanks!

Download All
0 Kudos
Message 3 of 3
(3,282 Views)