From: DouglasT Thoms on 4 Mar 2010 16:39 Hello, I am a coop student new to Matlab and need to plot an equation on it. Part of the equation consists of finding the distinct roots of polynomials in the interval of [0,1]. I have tried using fzero command and roots command, but no luck. Can any one suggest how to use fzero on this or roots command. Furthermore, can anyone suggest an approach. Do I need to program this from scratch?
From: John D'Errico on 4 Mar 2010 17:15 "DouglasT Thoms" <douglas.thoms(a)hotmail.co.jp> wrote in message <hmp9ac$fjj$1(a)fred.mathworks.com>... > Hello, > > I am a coop student new to Matlab and need to plot an equation on it. Part of the equation consists of finding the distinct roots of polynomials in the interval of [0,1]. > > I have tried using fzero command and roots command, but no luck. > > Can any one suggest how to use fzero on this or roots command. Furthermore, can anyone suggest an approach. > > Do I need to program this from scratch? No, you don't need to program it from scratch. In fact, either fzero or roots would suffice, but we won't do your work for you here, as that won't help you to learn anything. What did you try that did not work? John
From: DouglasT Thoms on 5 Mar 2010 12:55 Thanks for your response John. I tried using :fzero('legendre',n,x) :roots Tried the program below clear n=4; x = 0:.001:1; y=legendre(n,x); [i,j] = find(y<=0+1e-3 & y>=0+-1e-3); xj=x(1,j); xjsp=(x(1,j)).^2 This partially worked but the calculations were not accurate enough My professor just sent me the following code and I am trying it function leg = leg(n,m,x) y = legendre(n,x) leg = y(n,x) leg=y(m) fzero(@(x) leg(n,m,x),xvalue)
|
Pages: 1 Prev: compiled gui very slow Next: ACEL DSP COMPATIBLE CODE FOR HISTEQ |