Program for Linear and Polynomial Fit

Program for Linear and Polynomial Fit - Messaggi

#21 Pubblicato: 11/12/2019 13:31:21
Martin_B

Martin_B

22 apprezzamenti in 84 post.

Gruppo: User

Wrote



Hope this document will tranquilize visitors/users !

Jean.




If that's what you think.
#22 Pubblicato: 11/12/2019 19:05:16
Jean Giraud

Jean Giraud

983 apprezzamenti in 6.866 post.

Gruppo: User

Wrote

If that's what you think.


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


#23 Pubblicato: 11/12/2019 21:25:41
CBG

CBG

78 apprezzamenti in 312 post.

Gruppo: 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 Pubblicato: 12/12/2019 00:09:00
NDTM Amarasekera

NDTM Amarasekera

130 apprezzamenti in 352 post.

Gruppo: 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 Pubblicato: 12/12/2019 07:41:20
NDTM Amarasekera

NDTM Amarasekera

130 apprezzamenti in 352 post.

Gruppo: 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 Pubblicato: 12/12/2019 07:53:51
Martin_B

Martin_B

22 apprezzamenti in 84 post.

Gruppo: 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 Pubblicato: 12/12/2019 10:21:08
NDTM Amarasekera

NDTM Amarasekera

130 apprezzamenti in 352 post.

Gruppo: 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 Pubblicato: 12/12/2019 11:21:42
Martin_B

Martin_B

22 apprezzamenti in 84 post.

Gruppo: 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,92 KiB) scaricato 1275 volta(e).


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


vectorize.jpg
1 utenti hanno apprezzato questo post
sergio 12/12/2019 16:13:00
#29 Pubblicato: 12/12/2019 11:49:54
NDTM Amarasekera

NDTM Amarasekera

130 apprezzamenti in 352 post.

Gruppo: 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 Pubblicato: 12/12/2019 13:06:39
Jean Giraud

Jean Giraud

983 apprezzamenti in 6.866 post.

Gruppo: 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,79 KiB) scaricato 1295 volta(e).
#31 Pubblicato: 12/12/2019 15:12:19
Alvaro

Alvaro

1.139 apprezzamenti in 1.805 post.

Gruppo: 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,33 KiB) scaricato 1317 volta(e).
PolyFit.pdf (748,27 KiB) scaricato 818 volta(e).

Best regards.
Alvaro.
1 utenti hanno apprezzato questo post
sergio 12/12/2019 16:12:00
#32 Pubblicato: 12/12/2019 15:15:52
NDTM Amarasekera

NDTM Amarasekera

130 apprezzamenti in 352 post.

Gruppo: User

Thank you, Alvaro.
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka
  • Nuovi post
  • Nessun nuovo post