frznchckn
Member level 1
- Joined
- Jul 20, 2010
- Messages
- 36
- Helped
- 4
- Reputation
- 8
- Reaction score
- 4
- Trophy points
- 1,288
- Location
- California
- Activity points
- 1,521
I've just started learning dsp and am going through a book and doing some FIR filter problems.
I have a sequence x = [1 3 7 8 10]
>> x = [1 3 7 8 10]
x =
1 3 7 8 10
>> x(1)
ans =
1
>> x(5)
ans =
10
>> x(-1)
??? Index exceeds matrix dimensions.
>> x(6)
??? Index exceeds matrix dimensions.
Is there an easy way to have all invalid matrix dimensions to just return 0? I can obviously write a function to check if the value is within the valid matrix dimensions, but I'm looking for a built-in Matlab function.
Thanks.
I have a sequence x = [1 3 7 8 10]
>> x = [1 3 7 8 10]
x =
1 3 7 8 10
>> x(1)
ans =
1
>> x(5)
ans =
10
>> x(-1)
??? Index exceeds matrix dimensions.
>> x(6)
??? Index exceeds matrix dimensions.
Is there an easy way to have all invalid matrix dimensions to just return 0? I can obviously write a function to check if the value is within the valid matrix dimensions, but I'm looking for a built-in Matlab function.
Thanks.