Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: 'index out of bounds' error
Replies: 5   Last Post: Nov 27, 2012 9:56 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Jimbob

Posts: 3
Registered: 11/27/12
'index out of bounds' error
Posted: Nov 27, 2012 8:28 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi. I have a small error that I'm sure is down to my inexperience. Any help with this would be more than grateful!

I'm trying to script a Vocoder, that splits an audio signal into a number of filtered bands before processing them individually. The script below calculates the frequency bands and allocates them to 'Wp' for use in the filter.

The for loop is supposed to allocate the frequency bands from Wp for each channel before processing with another function (not scripted here).

The error from Matlab is as follows:

---------

Attempted to access Wp(2,3); index out of bounds because size(Wp)=[1,6].

Error in voc4channel (line 43)
[b, a] = ellip (n, Rp, Rs, Wp(i,i+1));

---------

And here's the script. Once again, if anybody can point me in the right direction I can move on. I'm currently very frustrated!

---------

clear all;
close all;
clc;

%% Load test sound:

fileName = uigetfile('*.wav');
[y, Fs, nbits] = wavread(fileName);

y_voc_out = zeros(size(y)); % initialise the output of the vocoder

%% Number of Channels: 1:24

numchan = input ('How Many Bands (1-24):')

%% Define the frequency bands

x = 35/numchan

f=[0:x:35]

%% Calculate Wp

Wp = (165.4*(10.^(0.06*f)-1))/(Fs/2)

%% Other filter settings

n = 5; % order of filter
Rp = 1; % dBripple in the passband
Rs = 70; % dB drop between pass and stop

%% Split into channels

for i=1:numchan % loop to split into channels

[b, a] = ellip (n, Rp, Rs, Wp(i,i+1));
y_channel = filter(b, a, y);

end

%% Play file

p = audioplayer (wnoise,Fs);
play (p);



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.