Prev: adftest
Next: Extract data from java applet?
From: Feijo de Beaufort on 16 Nov 2009 18:10 Hi All, I want to find out the roots of J0(x) = 0. Not at just one point, but a whole list of them. What is the easiest way of implementing this? I can put a simple loop around fzero, but that will give me duplicates: for i = 1:1000 f(i) = fzero(@(x)besselj(0,x),i); end Do any of you know how to implement this? Thank you very much, Eelco
From: Matt Fig on 16 Nov 2009 18:31 Why not just use unique on the results? Alternatively, you can use my newtzero function. It finds 202 roots, though they are not guaranteed to be inclusive between min and max. rt = newtzero(@(x)besselj(0,x),1); http://www.mathworks.com/matlabcentral/fileexchange/6924-newtzero
From: Feijo de Beaufort on 16 Nov 2009 21:04 Thanks for your response Matt, the unique function would definitely work since the point are spaced roughly 'pi' apart. However, I found another way of doing this: bessj0 = inline('besselj(0,x)'); for n = 1:n z(n) = fzero(bessj0,[(n-1) n]*pi); end just specify 'n' and it will give you the first n-values of J(z) = 0; Thanks for the help! Eelco
From: Loren Shure on 17 Nov 2009 09:00 In article <hdt0ak$84r$1(a)fred.mathworks.com>, feijooos(a)gmail.com says... > Thanks for your response Matt, the unique function would definitely work since the point are spaced roughly 'pi' apart. > > However, I found another way of doing this: > > bessj0 = inline('besselj(0,x)'); > for n = 1:n > z(n) = fzero(bessj0,[(n-1) n]*pi); > end > > just specify 'n' and it will give you the first n-values of J(z) = 0; > > Thanks for the help! > > Eelco > You are better off using anonymous functions, if this is your strategy: bessj0 = @(x) besselj(O,x) for n=1:K (shouldn't be n here) z(n) = fzero(bessj, etc. end -- Loren http://blogs.mathworks.com/loren
|
Pages: 1 Prev: adftest Next: Extract data from java applet? |