Program for Linear and Polynomial Fit

Program for Linear and Polynomial Fit - Messages

#21 Posted: 12/11/2019 1:31:21 PM
Martin_B

Martin_B

21 likes in 84 posts.

Group: User

Wrote



Hope this document will tranquilize visitors/users !

Jean.




If that's what you think.
#22 Posted: 12/11/2019 7:05:16 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

If that's what you think.


Does it work for you ... SS 7251 users please confirm ?


#23 Posted: 12/11/2019 9:25:41 PM
CBG

CBG

77 likes in 312 posts.

Group: User

Wrote

Wrote

If that's what you think.


Does it work for you ... SS 7251 users please confirm ?




Hello Jean

Yes, It works


Carlos
#24 Posted: 12/12/2019 12:09:00 AM
NDTM Amarasekera

NDTM Amarasekera

130 likes in 352 posts.

Group: User

Wrote

Originally Posted by: MarB [url=/forum/yaf_postsm60156_Program-for-Linear-and-Polynomial-Fit.aspx#post60156][/url]If that's what you think.
Does it work for you ... SS 7251 users please confirm ?



It works. Thank you MarB.
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka
#25 Posted: 12/12/2019 7:41:20 AM
NDTM Amarasekera

NDTM Amarasekera

130 likes in 352 posts.

Group: User

Wrote

That's my solution
- to separate the functions from matrix building,
- to use vectorize for speed



Apparently, the function f(#x):=1 if n=0 has a problem?. Or is it redundant?
For values n>0, the "otherwise" condition yields correct results irrespective of values in "if" condition.
Please check.

PolyFit_MB.png
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka
#26 Posted: 12/12/2019 7:53:51 AM
Martin_B

Martin_B

21 likes in 84 posts.

Group: User

Hi,

just put the 1 into a 1x1 matrix. That's all.

(And if you want to use units with the X Vector, just remove the eval and evaluate symbolically.)

Wrote


polyfit.png



Wrote

Wrote

That's my solution
- to separate the functions from matrix building,
- to use vectorize for speed



Apparently, the function f(#x):=1 if n=0 has a problem?. Or is it redundant?
For values n>0, the "otherwise" condition yields correct results irrespective of values in "if" condition.
Please check.



#27 Posted: 12/12/2019 10:21:08 AM
NDTM Amarasekera

NDTM Amarasekera

130 likes in 352 posts.

Group: User

Wrote

just put the 1 into a 1x1 matrix. That's all.



Hi
Still the same error when n=0.
Better if you can post the SM file please.
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka
#28 Posted: 12/12/2019 11:21:42 AM
Martin_B

Martin_B

21 likes in 84 posts.

Group: User

Sorry, I didn't realize, that vectorize behaves unexpectedly (to me), when the function does not include 'x'.

So I changed f to f(x):=[1+0*x] and now it works. The file is attached.
PolyFit.sm (11 KiB) downloaded 46 time(s).


I would expect the results of g and h to be the same, and to be a 3 items long vector.


vectorize.jpg
1 users liked this post
sergio 12/12/2019 4:13:00 PM
#29 Posted: 12/12/2019 11:49:54 AM
NDTM Amarasekera

NDTM Amarasekera

130 likes in 352 posts.

Group: User

Hi
Now I get same results as yours.
But the result (19.0833) of the Polyfit() function when n=0 ----> Does it have any meaning?
I have no idea. I was only testing it for all possible conditions..
Cheers MarB.

Note: Incidentally, 19.0833 happens to be the Mean of Y vector.
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka
#30 Posted: 12/12/2019 1:06:39 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

IMHO ... no need to complicate matters.
Modular design is easier to fix.
More automated is OK if you intend to poly for the entire Planet.

PolyFit (2).sm (46 KiB) downloaded 44 time(s).
#31 Posted: 12/12/2019 3:12:19 PM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1675 posts.

Group: User

Wrote


...
But the result (19.0833) of the Polyfit() function when n=0 ----> Does it have any meaning?
I have no idea. I was only testing it for all possible conditions..
...



Hi. This is in case you want to interpolate with an horizontal line.

Clipboard01.gif

PolyFit.sm (159 KiB) downloaded 54 time(s).
PolyFit.pdf (748 KiB) downloaded 53 time(s).

Best regards.
Alvaro.
1 users liked this post
sergio 12/12/2019 4:12:00 PM
#32 Posted: 12/12/2019 3:15:52 PM
NDTM Amarasekera

NDTM Amarasekera

130 likes in 352 posts.

Group: User

Thank you, Alvaro.
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka
  • New Posts New Posts
  • No New Posts No New Posts