Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Resample error

Subject: Resample error

From: Nicolas

Date: 28 Sep, 2012 22:47:21

Message: 1 of 7

Hello,

Our lab just installed Matlab R2012a on a new computer (Win7 64bit), and when I try to run a script that I used on a different computer, I get an error when it tries to use the resample function (where it would otherwise work just fine). We have the SigProc toolbox installed.

Even a simple test does not work:

test = [1:1000];
resample(test,1,2);

Error using .*
Matrix dimensions must agree.

Error in resample (line 75)
      h = p*firls( L-1, [0 2*fc 2*fc 1], [1 1 0 0]).*kaiser(L,bta)' ;

Any advice is greatly appreciated.
 

Subject: Resample error

From: Nasser M. Abbasi

Date: 28 Sep, 2012 22:59:10

Message: 2 of 7

On 9/28/2012 5:47 PM, Nicolas wrote:
> Hello,
>
> Our lab just installed Matlab R2012a on a new computer (Win7 64bit), and when I try to run
>a script that I used on a different computer, I get an error when it tries to use the
>resample function (where it would otherwise work just fine). We have the SigProc toolbox installed.
>
> Even a simple test does not work:
>
> test = [1:1000];
> resample(test,1,2);
>
> Error using .*
> Matrix dimensions must agree.
>
> Error in resample (line 75)
> h = p*firls( L-1, [0 2*fc 2*fc 1], [1 1 0 0]).*kaiser(L,bta)' ;
>
> Any advice is greatly appreciated.
>
>

I do not know why it fails. I tried it on my matlab 2012a with the SP toolbox
and it worked.

btw, test is a name of a matlab function (help test). You might
want to call your array test01 or something. But this should not
have to do with why you are getting the error.

--Nasser

Subject: Resample error

From: Steven_Lord

Date: 1 Oct, 2012 13:48:40

Message: 3 of 7



"Nasser M. Abbasi" <nma@12000.org> wrote in message
news:k45a41$1g6$1@speranza.aioe.org...
> On 9/28/2012 5:47 PM, Nicolas wrote:
>> Hello,
>>
>> Our lab just installed Matlab R2012a on a new computer (Win7 64bit), and
>> when I try to run
>>a script that I used on a different computer, I get an error when it tries
>>to use the
>>resample function (where it would otherwise work just fine). We have the
>>SigProc toolbox installed.
>>
>> Even a simple test does not work:
>>
>> test = [1:1000];
>> resample(test,1,2);
>>
>> Error using .*
>> Matrix dimensions must agree.
>>
>> Error in resample (line 75)
>> h = p*firls( L-1, [0 2*fc 2*fc 1], [1 1 0 0]).*kaiser(L,bta)' ;

Have you written your own function KAISER that is shadowing (being called
instead of) this KAISER function?

http://www.mathworks.com/help/signal/ref/kaiser.html

Or have you written your own FIRLS?

>> Any advice is greatly appreciated.
>>
>>
>
> I do not know why it fails. I tried it on my matlab 2012a with the SP
> toolbox
> and it worked.
>
> btw, test is a name of a matlab function (help test). You might
> want to call your array test01 or something. But this should not
> have to do with why you are getting the error.

The only functions named TEST that I can see in the documentation are
methods of various objects. I don't see a TEST function in the global
namespace that isn't a method.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Resample error

From: Nicolas

Date: 1 Oct, 2012 20:16:07

Message: 4 of 7

"Steven_Lord" <slord@mathworks.com> wrote in message <k4c6vn$jfh$1@newscl01ah.mathworks.com>...
>
>
> "Nasser M. Abbasi" <nma@12000.org> wrote in message
> news:k45a41$1g6$1@speranza.aioe.org...
> > On 9/28/2012 5:47 PM, Nicolas wrote:
> >> Hello,
> >>
> >> Our lab just installed Matlab R2012a on a new computer (Win7 64bit), and
> >> when I try to run
> >>a script that I used on a different computer, I get an error when it tries
> >>to use the
> >>resample function (where it would otherwise work just fine). We have the
> >>SigProc toolbox installed.
> >>
> >> Even a simple test does not work:
> >>
> >> test = [1:1000];
> >> resample(test,1,2);
> >>
> >> Error using .*
> >> Matrix dimensions must agree.
> >>
> >> Error in resample (line 75)
> >> h = p*firls( L-1, [0 2*fc 2*fc 1], [1 1 0 0]).*kaiser(L,bta)' ;
>
> Have you written your own function KAISER that is shadowing (being called
> instead of) this KAISER function?
>
> http://www.mathworks.com/help/signal/ref/kaiser.html
>
> Or have you written your own FIRLS?
>
> >> Any advice is greatly appreciated.
> >>
> >>
> >
> > I do not know why it fails. I tried it on my matlab 2012a with the SP
> > toolbox
> > and it worked.
> >
> > btw, test is a name of a matlab function (help test). You might
> > want to call your array test01 or something. But this should not
> > have to do with why you are getting the error.
>
> The only functions named TEST that I can see in the documentation are
> methods of various objects. I don't see a TEST function in the global
> namespace that isn't a method.
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

Thanks for the guidance Steve; your comment helped me work it out.

For future reference, I used the 'which' command for both kaiser and firls functions, and it turns out that another function named firls existed in another toolbox that I had downloaded. Once I removed that from the path, it worked!

Thanks again,
Nick

Subject: Resample error

From: Marc

Date: 6 Mar, 2013 03:37:08

Message: 5 of 7

"Nicolas " <nickbedo@yahoo.com> wrote in message <k4ctm7$lq9$1@newscl01ah.mathworks.com>...
> "Steven_Lord" <slord@mathworks.com> wrote in message <k4c6vn$jfh$1@newscl01ah.mathworks.com>...
> >
> >
> > "Nasser M. Abbasi" <nma@12000.org> wrote in message
> > news:k45a41$1g6$1@speranza.aioe.org...
> > > On 9/28/2012 5:47 PM, Nicolas wrote:
> > >> Hello,
> > >>
> > >> Our lab just installed Matlab R2012a on a new computer (Win7 64bit), and
> > >> when I try to run
> > >>a script that I used on a different computer, I get an error when it tries
> > >>to use the
> > >>resample function (where it would otherwise work just fine). We have the
> > >>SigProc toolbox installed.
> > >>
> > >> Even a simple test does not work:
> > >>
> > >> test = [1:1000];
> > >> resample(test,1,2);
> > >>
> > >> Error using .*
> > >> Matrix dimensions must agree.
> > >>
> > >> Error in resample (line 75)
> > >> h = p*firls( L-1, [0 2*fc 2*fc 1], [1 1 0 0]).*kaiser(L,bta)' ;
> >
> > Have you written your own function KAISER that is shadowing (being called
> > instead of) this KAISER function?
> >
> > http://www.mathworks.com/help/signal/ref/kaiser.html
> >
> > Or have you written your own FIRLS?
> >
> > >> Any advice is greatly appreciated.
> > >>
> > >>
> > >
> > > I do not know why it fails. I tried it on my matlab 2012a with the SP
> > > toolbox
> > > and it worked.
> > >
> > > btw, test is a name of a matlab function (help test). You might
> > > want to call your array test01 or something. But this should not
> > > have to do with why you are getting the error.
> >
> > The only functions named TEST that I can see in the documentation are
> > methods of various objects. I don't see a TEST function in the global
> > namespace that isn't a method.
> >
> > --
> > Steve Lord
> > slord@mathworks.com
> > To contact Technical Support use the Contact Us link on
> > http://www.mathworks.com
>
> Thanks for the guidance Steve; your comment helped me work it out.
>
> For future reference, I used the 'which' command for both kaiser and firls functions, and it turns out that another function named firls existed in another toolbox that I had downloaded. Once I removed that from the path, it worked!
>
> Thanks again,
> Nick

For me the error was downloading Moler's book and leaving it high in the path, above the toolboxes.

In his book he has a 'sinc.m' function that was giving firls.m problems.

Subject: Resample error

From: Steven_Lord

Date: 6 Mar, 2013 15:01:53

Message: 6 of 7



"Marc " <marc.schreier@uop.com> wrote in message
news:kh6dl4$4fm$1@newscl01ah.mathworks.com...
> "Nicolas " <nickbedo@yahoo.com> wrote in message
> <k4ctm7$lq9$1@newscl01ah.mathworks.com>...
>> "Steven_Lord" <slord@mathworks.com> wrote in message
>> <k4c6vn$jfh$1@newscl01ah.mathworks.com>...

*snip*

> For me the error was downloading Moler's book and leaving it high in the
> path, above the toolboxes.

Which book? Numerical Computing with MATLAB, Experiments with MATLAB, or a
different book?

http://www.mathworks.com/moler/

> In his book he has a 'sinc.m' function that was giving firls.m problems.

I just checked both the ZIP-files containing software for Cleve's books
(from the webpage linked above) and in neither of them did I see a sinc.m
function. Or was this sinc.m function something that he asked the reader to
write as part of one of the end-of-chapter exercises and you placed it in
the same folder as the rest of the files associated with that textbook? That
seems like a reasonable choice of location for your solution to one of
Cleve's assignments.

I want to make sure that nothing from Cleve's textbook is causing problems
for students trying to use MATLAB.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Resample error

From: Marc

Date: 22 Jun, 2013 02:46:19

Message: 7 of 7

"Steven_Lord" <slord@mathworks.com> wrote in message <kh7lp2$pg6$1@newscl01ah.mathworks.com>...
>
>
> "Marc " <marc.schreier@uop.com> wrote in message
> news:kh6dl4$4fm$1@newscl01ah.mathworks.com...
> > "Nicolas " <nickbedo@yahoo.com> wrote in message
> > <k4ctm7$lq9$1@newscl01ah.mathworks.com>...
> >> "Steven_Lord" <slord@mathworks.com> wrote in message
> >> <k4c6vn$jfh$1@newscl01ah.mathworks.com>...
>
> *snip*
>
> > For me the error was downloading Moler's book and leaving it high in the
> > path, above the toolboxes.
>
> Which book? Numerical Computing with MATLAB, Experiments with MATLAB, or a
> different book?
>
> http://www.mathworks.com/moler/
>
> > In his book he has a 'sinc.m' function that was giving firls.m problems.
>
> I just checked both the ZIP-files containing software for Cleve's books
> (from the webpage linked above) and in neither of them did I see a sinc.m
> function. Or was this sinc.m function something that he asked the reader to
> write as part of one of the end-of-chapter exercises and you placed it in
> the same folder as the rest of the files associated with that textbook? That
> seems like a reasonable choice of location for your solution to one of
> Cleve's assignments.
>
> I want to make sure that nothing from Cleve's textbook is causing problems
> for students trying to use MATLAB.
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

Hey Steve

Your appear to be correct. I must have created my own monster.

I have "Numerical Computing with Matlab" circa 2004... No sinc.m in the contents file so I must have put that there??

Although, in my defense, this doesn't look like something I would have written. I tend to indent, comment, use lots of useless dribble... This is too clean for my work.

function f = sinc(x)
if x == 0
f = 1;
else
f = sin(x)/x;
end

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us