- #1

- 169

- 0

## Homework Statement

Ok so Im slowly learning the syntax and various functions of Matlab. I am triyng to design and plot an FIR bandpass filter. Below is a coefficent h(k). I need to define this h(k) in 3 parts from what I understand. for k=0:p-1, k=p, and k=p+1:m to satisfy.

[itex]h(k)= \frac{sin(2 \pi(k-p)F_{1}T)-sin(2 \pi(k-p)F_{0}T)}{\pi(k-p)} [/itex]for o≤k≤m,k≠0

[itex]h(k)=2(F_{1}-F_{0})T [/itex] for k=p

[itex]h(k)=0

[/itex] otherwise

## Homework Equations

N/A

## The Attempt at a Solution

This is what I have

k=0:m;

h1=(sin(2*pi*(k-p)*f1)-sin(2*pi*(k-p)*f0))/(pi*(k-p));

This not fully correct. What I dont understand is how to put these ranges for the variable k within each string? Above I am defining it for the entire simulation. I dont even know how to properly search for this in google as I dont know what it would be called. I cant image it is too complicated but I just dont know the syntax. Ive tried a couple of different ways but nothing really worked correctly.

Any help would be much appreciated!