"Prashant" wrote in message <ku6487$4d6$1@newscl01ah.mathworks.com>...
> "Prashant" wrote in message <ku5sf4$htj$1@newscl01ah.mathworks.com>...
> > Hello all,
> >
> > I am writing a program that uses integral2 or integral3. At any given choice of k,theta, and phi, I want to find the eigenvalues of a 30x30 matrix whose elements depend on k, theta, and phi. However, I believe integral2 and and integral3 use a meshgrid like approach to generate the parameter space for the integration variables. As a result, I can pass the vectors for k, theta, and phi generated by integral2 or integral3 into my function that generates my matrix but then it throws an error because eig cannot handle vectorized inputs. Is there anyway that I can go about doing this efficiently?
> >
> > Thanks in advance.
> >
> > Prashant
>
> To clarify a little bit:
>
> I want to make a call to integral2 or integral3 by making a call to a function that generates the integrand. Within the integrand function, the integrand needs to be constructed at each integration point because I am generating one of the terms on-the-fly using a separate function that takes the integration step position as an input. This function computes the eigenvalues of a 30x30 matrix (which is constructed based on the supplied input) and then outputs one of the eigenvalues back to the integrand function. This value is then used to construct the integrand to be evaluated by integral2 or integral3.
>
> The problem that I am having is that integral2 and integral3 in the tiled method adaptively update the map of the integration parameter space. Instead of optimizing the entire parameter space, it updates in chunks. However when it tries to update a subset of the parameter space, the eigenvalue function spits out results only for that subset region and as a result I get a dimension error.
>
> Regards,
> Prashant
If integral2 and integral3 pass vectors for k, theta and phi, why don't you call eig in a loop for the vector elements (k(1),theta(1),phi(1)), (k(2),theta(2),phi(2)) and so on?
Best wishes
Torsten.
> "Prashant" wrote in message <ku5sf4$htj$1@newscl01ah.mathworks.com>...
> > Hello all,
> >
> > I am writing a program that uses integral2 or integral3. At any given choice of k,theta, and phi, I want to find the eigenvalues of a 30x30 matrix whose elements depend on k, theta, and phi. However, I believe integral2 and and integral3 use a meshgrid like approach to generate the parameter space for the integration variables. As a result, I can pass the vectors for k, theta, and phi generated by integral2 or integral3 into my function that generates my matrix but then it throws an error because eig cannot handle vectorized inputs. Is there anyway that I can go about doing this efficiently?
> >
> > Thanks in advance.
> >
> > Prashant
>
> To clarify a little bit:
>
> I want to make a call to integral2 or integral3 by making a call to a function that generates the integrand. Within the integrand function, the integrand needs to be constructed at each integration point because I am generating one of the terms on-the-fly using a separate function that takes the integration step position as an input. This function computes the eigenvalues of a 30x30 matrix (which is constructed based on the supplied input) and then outputs one of the eigenvalues back to the integrand function. This value is then used to construct the integrand to be evaluated by integral2 or integral3.
>
> The problem that I am having is that integral2 and integral3 in the tiled method adaptively update the map of the integration parameter space. Instead of optimizing the entire parameter space, it updates in chunks. However when it tries to update a subset of the parameter space, the eigenvalue function spits out results only for that subset region and as a result I get a dimension error.
>
> Regards,
> Prashant
If integral2 and integral3 pass vectors for k, theta and phi, why don't you call eig in a loop for the vector elements (k(1),theta(1),phi(1)), (k(2),theta(2),phi(2)) and so on?
Best wishes
Torsten.