# design of filter without using built-in functions in matlab

Status
Not open for further replies.

##### Newbie level 2 convolution in matlab without using conv

hi!
i am suppose to design a low pass filter(lpf) using any window methods without uisng built-in functions in matlab. and the output should be a frequency response of the filter.

i could find coefficients of window(simply by substituting the formula for one of the windows) but designing the lpf without using the built-in functions has been very irritating !!

if anyone could help me concerned with this i will be very thankful!!!

thank you!

#### Kral fir filter without matlab function

Any good book on digital signal processing or digital filters will show the technique. Also, see:
.
Regards,
Kral

• anicser

### anicser

Points: 2

#### svhb

##### Full Member level 5 matlab built filter from coeff

This is a typical project to give you some hands-on experience with digital FIR filters. If you have some feeling with the theory, you should be able to do this :

- Rectangular frequence response (store in an vector)
- inverse dft on it
- apply window

there the filter is.

The frequency response is the opposte :

- take the filter coeficients
- apply dft

##### Newbie level 2 how to apply a filter in matlab

thank you mr.kral and svhb!

##### Member level 2 matlab filter function

svhb said:
This is a typical project to give you some hands-on experience with digital FIR filters. If you have some feeling with the theory, you should be able to do this :

- Rectangular frequence response (store in an vector)
- inverse dft on it
- apply window

there the filter is.

The frequency response is the opposte :

- take the filter coeficients
- apply dft

Please i want some help in using fdatool in matlab. I designed my filter but don't know how to apply it to my signal.

I do export the filter as an object or to workspace or as an SOS matrix, or even as an m-file. But i can't apply this filter to my original signal.
How can i get that.

Or if u suggest any other method for me to design a BPF and apply it to my signal.
I've really got confused.

#### svhb

##### Full Member level 5 dft filter in matlab

For a FIR-filter : if you have your filter coeficients, you use concolution to apply it to your signal. (this is basically how the filter works).

Code:
w = conv(u,v) convolves vectors u and v. Algebraically, convolution is the same operation as multiplying the polynomials whose coefficients are the elements of u and v.

##### Member level 2 matlab programs of dft without builtin function

svhb said:
For a FIR-filter : if you have your filter coeficients, you use concolution to apply it to your signal. (this is basically how the filter works).

Code:
w = conv(u,v) convolves vectors u and v. Algebraically, convolution is the same operation as multiplying the polynomials whose coefficients are the elements of u and v.

Now, I've exported my BPF's coefficients in the workspace of matlab as num, den.
so, which function should i use to apply the filter to my signal.
I've used the function
filter(num,den,x) %%% where x=my data signal
but i have no result.
The code that u've written of using conv(u,v)
I think it can't work coz my coefficients r 2 vectors, num & den
and i want to apply it on my signal x
but, the conv function have just 2 arguments.

Is there any other function that works for my num & den coefficients.
And, sorry for interruption.

#### svhb

##### Full Member level 5 matlab built in functions code

Num and den are the coeficients for the polynomials defining A and B in
H(Z) = B(Z)/A(Z)

When the coeficients of A are zero, except the first one, you made a FIR filter, and just divide all coeficient from B with a0. This is the impulse respone of the filter, and is finite (Finite Impluse Response filter). You can use these coeficients to do a convolution with your input signal.

When there are other coeficients than the first one of A are nonzero, you made an IIR filter (Infinite Impulse response filter). You can find the impulse respone by dividing the polynomials A and B, and you will see it never ends (but the results become smalleer and smaller, I hope). Because the impulse response never ends, it's inpractical to do with convolution.

If you look at how a digital filter works, it will be not to difficult to apply the filter to any input signal.

#### xie.qiang

##### Junior Member level 1 calculate the inverse of a fir filter in matlab

svhb said:
This is a typical project to give you some hands-on experience with digital FIR filters. If you have some feeling with the theory, you should be able to do this :

- Rectangular frequence response (store in an vector)
- inverse dft on it
- apply window

there the filter is.

The frequency response is the opposte :

- take the filter coeficients
- apply dft

For your information, for the response of filter, I do respectly a bit disagree with you while by using inverse DFT instead of DTFT, for the former is disceret frequency response while the latter is the correct continuous period discrete time fourier transform.

#### svhb

##### Full Member level 5 matlab code without inbuilt functions

indeed it needs to be the discrete version of the transform, with DFT, I mean Discrete Fourrier Transform.

#### Aya2002 using a filter as window matlab

thanks to svhb

#### xulfee convolution matlab without using conv

get ur transfer function from coefficent of filters by using tf(z,p) then multiply it wuth ur input

#### Aya2002 filters without using matlab function