matlab program help

Please support our Legacy and Other Languages advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Mar 2005
Posts: 1
Reputation: default is an unknown quantity at this point 
Solved Threads: 0
default default is offline Offline
Newbie Poster

matlab program help

 
0
  #1
Mar 1st, 2005
hi i'm not sure how to start this program.


The program is:

to take in a set of x and y data, perform the least squares regression, and use the coefficients to predict values for the x values given and print the x, y and predicted y values.

Input should come from A FILE in the form: x y. The x-values should be read in to one floating point array and the y-values into another floating point array, so that the array index (element) identifies the dependent (y) and independent (x) values that belong together. For example, the first x, y values will be stored in position (or element, or index) 1 in each of the array of x values and array of y values. Reading of the values should be accomplished using a function called in the following way:


[fXValues, fYValues, iNValues] = readXYPairs(FIDIn)
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 4,055
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 935
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: matlab program help

 
0
  #2
Mar 10th, 2005
Could you give us a code sample of what you have done so far, it might get some MatLab experts interested.
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 35
Reputation: b4codes is an unknown quantity at this point 
Solved Threads: 1
b4codes b4codes is offline Offline
Light Poster

Re: matlab program help

 
0
  #3
May 11th, 2006
your problem is simple, first use "load" functiom to load both of your files (for x and y) then you can use "polyfit" function to perform the least square regression and you are all set. in case you have not used "polyfit" before:

polyfit finds the coefficients of a best-fit polynomial of any required degree. The following codes tries to fit a degree 3 polynomial to a sin curve
x=1:10; y=sin(x); [P,S] = polyfit(x,y,3); yfit= polyval(P,x); %Now compare y with yfit plot(x,y,x,yfit);you may also like to visit kluid (http://www.kluid.com), it is the matlab forum from where, I generally take help on matlab.

b4 : ]



Originally Posted by default
hi i'm not sure how to start this program.

The program is:

to take in a set of x and y data, perform the least squares regression, and use the coefficients to predict values for the x values given and print the x, y and predicted y values.

Input should come from A FILE in the form: x y. The x-values should be read in to one floating point array and the y-values into another floating point array, so that the array index (element) identifies the dependent (y) and independent (x) values that belong together. For example, the first x, y values will be stored in position (or element, or index) 1 in each of the array of x values and array of y values. Reading of the values should be accomplished using a function called in the following way:


[fXValues, fYValues, iNValues] = readXYPairs(FIDIn)
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Legacy and Other Languages Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC