From: Steven Lord on

"Snow White" <gulesaman(a)gmail.com> wrote in message
news:hur55o$2hq$1(a)fred.mathworks.com...
>P is a row vector of size 1 7749245

Didn't we have this discussion earlier in the thread? Look at posts 4 and 7
in this thread.

Make A, B, C, and D column vectors.
Combine them together to make an N-by-5 matrix p.
Loop over the rows of p.
Calculate the ROOTS of each row and store them in the rows of theroots.

--
Steve Lord
slord(a)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


From: Snow White on
Thank you.

I have done as u had suggested but i dont understand how should i index the resultant theroots? i have done the following:

[pr,pc]=size(p);
for pr_index=1:pr
theroots(:,:)= roots(p(pr_index,:)); %%computing roots of the equation inorder to find the refractive index
end
but that ofcourse only gives the last value stored in it. and the size is as follows:
size(theroots(:,:))

ans =

4 1

i am confused about how to extract the roots at each point.
bye
"Steven Lord" <slord(a)mathworks.com> wrote in message <hur5c4$fab$1(a)fred.mathworks.com>...
>
> "Snow White" <gulesaman(a)gmail.com> wrote in message
> news:hur55o$2hq$1(a)fred.mathworks.com...
> >P is a row vector of size 1 7749245
>
> Didn't we have this discussion earlier in the thread? Look at posts 4 and 7
> in this thread.
>
> Make A, B, C, and D column vectors.
> Combine them together to make an N-by-5 matrix p.
> Loop over the rows of p.
> Calculate the ROOTS of each row and store them in the rows of theroots.
>
> --
> Steve Lord
> slord(a)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
>
From: Steven Lord on

"Snow White" <gulesaman(a)gmail.com> wrote in message
news:hur9f4$ht2$1(a)fred.mathworks.com...
> Thank you.
>
> I have done as u had suggested but i dont understand how should i index
> the resultant theroots? i have done the following:
>
> [pr,pc]=size(p);
> for pr_index=1:pr
> theroots(:,:)= roots(p(pr_index,:)); %%computing roots of the equation
> inorder to find the refractive index
> end
> but that ofcourse only gives the last value stored in it. and the size is
> as follows:
> size(theroots(:,:))

You're almost there. On the right-hand side of the body of your FOR loop,
you extracted row pr_index of p. Now on the left-hand side you want to
insert the results into row pr_index of theroots. Since those sentences
sound somewhat similar in their descriptions, perhaps the code is similar?

theroots(pr_index, ...

--
Steve Lord
slord(a)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


From: Snow White on
i had already tried that :
for pr_index=1:pr
theroots(pr_index,:)= roots(p(pr_index,:)); %%computing roots of the equation inorder to find the refractive index
end
and i get this
??? Subscripted assignment dimension mismatch.
roots gives 4 root values for each element.

"Steven Lord" <slord(a)mathworks.com> wrote in message <hurf0o$q4c$1(a)fred.mathworks.com>...
>
> "Snow White" <gulesaman(a)gmail.com> wrote in message
> news:hur9f4$ht2$1(a)fred.mathworks.com...
> > Thank you.
> >
> > I have done as u had suggested but i dont understand how should i index
> > the resultant theroots? i have done the following:
> >
> > [pr,pc]=size(p);
> > for pr_index=1:pr
> > theroots(:,:)= roots(p(pr_index,:)); %%computing roots of the equation
> > inorder to find the refractive index
> > end
> > but that ofcourse only gives the last value stored in it. and the size is
> > as follows:
> > size(theroots(:,:))
>
> You're almost there. On the right-hand side of the body of your FOR loop,
> you extracted row pr_index of p. Now on the left-hand side you want to
> insert the results into row pr_index of theroots. Since those sentences
> sound somewhat similar in their descriptions, perhaps the code is similar?
>
> theroots(pr_index, ...
>
> --
> Steve Lord
> slord(a)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
>