Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to program PLC for least Squares

Status
Not open for further replies.

dougplc

Electrical
May 2, 2006
2
Can someone help me determine how to program a least squares routine for determining the slope and intercept for a number of xy coordinates? I am using an AB Micrologix 1100. Thanks.
 
Replies continue below

Recommended for you

This is sort of a dirty solution but you place your x data in the array starting at f9:0 and the corrosponding y data in F10:0. Then you place the number of data points in N7:1. Call the routine and it returns A in f11:12 and B in F11:16. Use the equation y = A + Bx for your curve fitting.

I have uploaded a file but have not tested it but you should see how it works if I made a mistake.

Lanny
 
 http://files.engineering.com/getfile.aspx?folder=214834be-5006-47e8-a44a-7fa74ba4490b&file=LEASTSQU.RSS
Status
Not open for further replies.

Part and Inventory Search

Sponsor