polyval issues #2

  • Follow


Hello! 

I'm trying very hard to use polyval to evaluate a polynomial fit of a function but I'm about to go find a very long and heavy metal pipe and repeatedly bash my computer till all i see are bits and pieces raw destruction and then go have a picnic by myself in an open grassy field somewhere. 

I digress. I have a simple set of data (homework assignment) and used polyfit to get my coefficients. Then i just want to take the fitted data, plot it, and then do some more error analysis on it. 

When I put in this code:

 x = [1,2,3,4];
 y = [1.7,1.8,2.3,3];
 p = polyfit(x,y,3);
 f = polyval(p,x);
 
i get this error : "??? Subscript indices must either be real positive integers or logicals."

So then i backtracked and looked up examples of polyval and just copied and pasted the simple 2 line example and ran it.

p = [3 2 1];
polyval(p,[5 7 9])

Same error. Why... why... whyy.... does polyval not work? I'm running Matlab 7.8.0 
0
Reply Paul 11/8/2010 8:39:04 PM

Make your own life time easier get the <a href="http://bestfinance-blog.com/topics/home-loans">home loans</a> and everything you require. 
0
Reply LunaVicky35 12/1/2010 3:46:37 AM


2 Replies
746 Views

(page loaded in 0.018 seconds)

Similiar Articles:










7/26/2012 1:29:24 PM


Reply: