Search All of the Math Forum:

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

Topic: A question about the chebfun() function
Replies: 4   Last Post: Jul 1, 2012 11:53 PM

 Messages: [ Previous | Next ]
 Jeff Posts: 2 Registered: 6/30/12
Re: A question about the chebfun() function
Posted: Jun 30, 2012 11:49 PM

Thanks Nasser!

The complete code is as follows:

trunc=30;
tic
L = chebop(@(x,u) diff(u,4), [0,1]);
L.lbc = @(u) diff(u,2);
L.lbc =@(u) diff(u,3);
L.rbc = @(u) diff(u,2);
L.rbc =@(u) diff(u,3);
[V,D] = eigs(L,trunc);
disp(diag(D)), toc

where trunc means how many eigenvalues I am asking for. In the above code, trunc=30 means I am asking chebfun() to find the first 30 eigenvalues.

I agree with you that the above code produces some nonsquare matrix, which causes this error. But presumably the above code should present some square matrix, right? I have no idea what causes such nonsquare matrix. I tested the examples included in the chebfun document, which all produce square matrices.

Thanks again for your kind help!
Jeff

"Nasser M. Abbasi" <nma@12000.org> wrote in message <jsofp0\$996\$1@speranza.aioe.org>...
> On 6/30/2012 10:04 PM, Jeff wrote:
> > Hi folks,
> >
> > I am using the chebfun function to find the eigenvalues and eigenfunctions
> >of the following boundary value problem
> >
> > D^4 y=lambda*y, y''(0)=y'''(0)=y''(1)=y'''(1)=0,
> >
> > where D is the differential operator, lambda is the eigenvalue and
> >the solution y is the corresponding eigenfunction.
> >
> > I used the following code in chebfun:
> >
> > L = chebop(@(x,u) diff(u,4), [0,1]);
> > L.lbc = @(u) diff(u,2);
> > L.lbc =@(u) diff(u,3);
> > L.rbc = @(u) diff(u,2);
> > L.rbc =@(u) diff(u,3);
> > [V,D] = eigs(L,trunc);
> > disp(diag(D)), toc
> >
> > HOWEVER, the below error was reported
> >
> > Error using eig
> > Matrix must be square.
> >

>
>
> what is trunc ? Please post complete code that can be run.
>
> non square matrix does not have eigenvalues by definition.
>
> " E = eig(X) is a vector containing the eigenvalues of a square
> matrix X."
>
> note the words "square matrix" above.
>
> try eig(sqrt(L*L')) instead and see if this helps in your problem.
>
> --Nasser

Date Subject Author
6/30/12 Jeff
6/30/12 Nasser Abbasi
6/30/12 Jeff
7/1/12 Nasser Abbasi
7/1/12 Steven Lord