|
"Maite" <maitelameris@hotmail.com> wrote in message
news:1302467408.72443.1286552744352.JavaMail.root@gallium.mathforum.org...
> Thanks for the reply, however, we still have some difficulties:
>
> 1) When N=64636, A would be a very big matrix of order 64636.
The question was not what _would_ A be but what _is_ A. I think you'll find
that the way you've written your code in fact A is NOT a 64636-by-64636
matrix when N is equal to 64636. Think about how to correct that problem.
> But we cant figure out how it came to such a high N-value. Using a
> While-statement should make the program stop when this condition
> (sum(eig(A))<1000) doesnt hold anymore, shouldnt it? That couldnt be
> for such a high N, could it?
Why not? What are the eigenvalues of -eye(N)? What is the sum of those
eigenvalues as a function of N?
> 2) We want to know which order the matrix has (N) when the sum of the
> eigenvalues is for the first time over a 1000. With initiating a counter,
> do you mean like this:
>
> Count=0
> N=1
> A=magic(N)
> While sum(eig(A))<1000
> N=N+1
> Count=Count+1
> End
> N
> Count
>
> This is another program, we thought about:
> N=1
> A=magic(N)
> If sum(eig(A))>=1000
> N
> Else N=N+1
> End
>
> Thank you for the help youve already given us, and we hope you would look
> at the program again. The computers at uni arent available, because of
> the problems. But we will try the program on Monday (no other
> possibilities
> :(), thats why we still have difficulties seeing the issues with our
> program.
In this case, work through your code, line by line, using pencil and paper
(or marker and whiteboard, or your favorite writing utensil/writing material
combination.) Execute the code exactly as you're written it (not as you
think it should work.) I think you'll locate the problem fairly quickly,
after a few iterations through the loop.
--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com
|