Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

i want to design a digital filter with specified impulse respone in matlab

Status
Not open for further replies.

Qwme5

Junior Member level 2
Joined
Jan 19, 2011
Messages
23
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,444
i want to design a digital filter to in matlab with the given impulse response attached to filter a complex guassian process of length 100

i dont know how am gonna to do it and i dont know how can i determine the order of the filter below attached the impulse response formula Untitled.png
 

Hi,

formulas (4)-(5)-(6) gives you the procedure to obtain the coefficients of the FIR filter you need.
You must take into account that array indexes in Matlab start from 1 instead of 0 like in the formulas.
Matlab has built-in Gamma and Bessel functions, as well as Hamming window.
You must have fd, ts and M. And, of course, you must have some knowledge of Matlab.

There is something that sounds strange to me: in (4) you have the quotient fd/ts instead of the product. I assume ts is a sampling interval, but what is fd?
Warning: if you use M even, there is an indetermination in (4) that is avoided fon odd M.

Regards

Z
 
  • Like
Reactions: Qwme5

    Qwme5

    Points: 2
    Helpful Answer Positive Rating
fd=100Hz

and ts=0.1ms

so can u help for the code

or code u give me a partial code

coz i am new with matlab
 

Qwme5,

i didn't mean which is the value of fd, but what it means.
Anyway, i advise you to try to write the code by yourself and request for help if you have a specific problem. Otherwise, it is too difficult that you can understand it. Use Matlab help.
Regards

Z
 
  • Like
Reactions: Qwme5

    Qwme5

    Points: 2
    Helpful Answer Positive Rating
this is the code but i think something wrong on it can u check plz


Code:
m=99;
fd=100;
n=0;
n=n+1;
ts=1e-4;
fs=1e4;

for i=1:100
b=abs((n-(m/2))*1e-4);
c=(100/(pi*b))^(1/4);
f=(2*pi*fd*b);
d=besselj(1/4,f);
h_n(i)=gamma(3/4)*c*d;
n=n+1;
end

%normalization of the windowed impulse resoinse
n=0;
k=0;
for i=1:99
k=(abs(hn_windowed(i)).^2);
n=n+k;
end
n=sqrt(n);
hn_windowed_norm=hn_windowed./n;


---------- Post added at 10:10 ---------- Previous post was at 10:06 ----------

and another thing i dont know what should be the value of M (order of the filter) I've chosen randomly
 

Hi,

Try this modified version based on your code:

PHP:
m=99;
fd=100;
ts=1e-4;

for n=0:m-1
    b=abs((n-(m/2))*ts);
    c=(fd/(pi*b))^(1/4);
    f=(2*pi*fd*b);
    d=besselj(1/4,f);
    h_n(n+1)=gamma(3/4)*c*d;
end

hn_windowed = h_n .* hamming(m)';

%normalization of the windowed impulse resoinse

hn_windowed_norm = hn_windowed / sqrt(sum(hn_windowed.^2));

Be sure that you understand all the code.
Regards

Z
 
  • Like
Reactions: Qwme5

    Qwme5

    Points: 2
    Helpful Answer Positive Rating
thanks alot zorro that was very helpful u helped me so much :)

---------- Post added at 06:55 ---------- Previous post was at 06:50 ----------

i have one question why u choose m to be equal = 99
 

i have one question why u choose m to be equal = 99
I didn't! You did!
I just left that value from your first line.

The "right" value of M depends upon the application. Clearly, truncating a sequence (in this case the impulse response) that should be infinite creates some distortio.
How much distortion can you tollerate? There are trade-offs between the distortion attained and other factors like complexity of the system, computing time, delay, etc.

A possible criterion for the selection of M would be a quadratic metric like this:
The energy of the discarded part is much less (K times) than te energy of the part considered.

As h(n) is even (symmetric wrt 0) That is (i hope that in words it is clear):

sum from n=0 to M/2 of [h(n)]^2 >= K * sum from n=M/2+1 to infinity of [h(n)]^2 .

If you are not concerned with that constraints, you could take a value of M much grater that needed.
Regards

Z
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top