Prev: GUI issue: plot axes won't clear when using multiple layers
Next: stop datacursormode callback from executing after panning
From: Andrei on 2 Aug 2010 16:50 Hello everyone, I have a problem to solve and I can't find an answer for it. I hope someone can help me. I have a vector of values (let's say I generated 100 of them using a sinus function) and I want to find the coefficients/fit this curve and using a model and predict the value at time step 101. This is some work that i have done so far with no meaningful results: %-------------------------------- N=100; x = [1 : N]; y = sin(x); %-----------setup--------------- mb = ar(y,1,'burg'); yy = sim(mb,e); // what should this error vector be? plot(1:N,y,1:N,yy); What is that e error vector? How do I get that e from 100 measurements? Am I doing the wrong thing? Can anyone send me a link with some sample code I could use? Thanks in advance, Andrei
From: Wayne King on 2 Aug 2010 17:28 "Andrei " <barbossusus(a)yahoo.ca> wrote in message <i37b2d$2rh$1(a)fred.mathworks.com>... > Hello everyone, > > I have a problem to solve and I can't find an answer for it. I hope someone can help me. > I have a vector of values (let's say I generated 100 of them using a sinus function) and I want to find the coefficients/fit this curve and using a model and predict the value at time step 101. > > This is some work that i have done so far with no meaningful results: > %-------------------------------- > N=100; > x = [1 : N]; > y = sin(x); > %-----------setup--------------- > mb = ar(y,1,'burg'); > yy = sim(mb,e); // what should this error vector be? > plot(1:N,y,1:N,yy); > > What is that e error vector? How do I get that e from 100 measurements? Am I doing the wrong thing? Can anyone send me a link with some sample code I could use? > > Thanks in advance, > Andrei Hi Andrei see the help for predict >>doc ident/predict Wayne
From: Andrei on 3 Aug 2010 14:28 > > Hi Andrei see the help for > predict > > >>doc ident/predict > > Wayne Hello Wayne, Thanks a lot for the quick reply. Apart from predict I also found this example : http://www.mathworks.com/products/matlab/demos.html?file=/products/demos/shipping/matlab/census.html My question is now, whether the degrees ,(1-8) mentioned in the last graph, represent the lag in an autoregressive model. Thanks again, Andrei
From: Wayne King on 3 Aug 2010 14:46
"Andrei " <barbossusus(a)yahoo.ca> wrote in message <i39n3q$2cp$1(a)fred.mathworks.com>... > > > > Hi Andrei see the help for > > predict > > > > >>doc ident/predict > > > > Wayne > > Hello Wayne, > > Thanks a lot for the quick reply. Apart from predict I also found this example : > > http://www.mathworks.com/products/matlab/demos.html?file=/products/demos/shipping/matlab/census.html > > My question is now, whether the degrees ,(1-8) mentioned in the last graph, represent the lag in an autoregressive model. > > Thanks again, > Andrei Hi Andrei, those are degrees of polynomials. They are fitting polynomials of differing orders to the data, so fitting something like: y = a*x^4+b*x^3+c*x^2+d*x+e would be a 4-th order, or quartic fit, and so on. See the help for polyval and polyfit. Wayne |