SMath Studio Forum
»
SMath Studio
»
Samples
»
Program for Linear and Polynomial Fit
Rank: Advanced Member Groups: Registered
Joined: 21/10/2016(UTC) Posts: 84
Was thanked: 21 time(s) in 17 post(s)
|
Originally Posted by: Jean Giraud
Hope this document will tranquilize visitors/users !
Jean.
If that's what you think.
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: MarB If that's what you think. Does it work for you ... SS 7251 users please confirm ?
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 14/10/2015(UTC) Posts: 308
Was thanked: 77 time(s) in 58 post(s)
|
Originally Posted by: Jean Giraud Originally Posted by: MarB If that's what you think. Does it work for you ... SS 7251 users please confirm ? Hello Jean Yes, It works Carlos
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 05/06/2014(UTC) Posts: 348 Location: Colombo Was thanked: 125 time(s) in 82 post(s)
|
Originally Posted by: Jean Giraud 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 |
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 05/06/2014(UTC) Posts: 348 Location: Colombo Was thanked: 125 time(s) in 82 post(s)
|
Originally Posted by: MarB 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. Edited by user 12 December 2019 13:47:51(UTC)
| Reason: Not specified |
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka |
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 21/10/2016(UTC) Posts: 84
Was thanked: 21 time(s) in 17 post(s)
|
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.) Originally Posted by: MarB Originally Posted by: ndtma Originally Posted by: MarB 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.
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 05/06/2014(UTC) Posts: 348 Location: Colombo Was thanked: 125 time(s) in 82 post(s)
|
Originally Posted by: MarB 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. Edited by user 12 December 2019 16:25:22(UTC)
| Reason: Not specified |
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka |
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 21/10/2016(UTC) Posts: 84
Was thanked: 21 time(s) in 17 post(s)
|
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 (12kb) downloaded 17 time(s).I would expect the results of g and h to be the same, and to be a 3 items long vector.
|
1 user thanked MarB for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 05/06/2014(UTC) Posts: 348 Location: Colombo Was thanked: 125 time(s) in 82 post(s)
|
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. Edited by user 12 December 2019 17:55:26(UTC)
| Reason: Additional checks |
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka |
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
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 (47kb) downloaded 17 time(s).
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 28/08/2014(UTC) Posts: 1,357 Was thanked: 815 time(s) in 516 post(s)
|
Originally Posted by: ndtma ... 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. PolyFit.sm (160kb) downloaded 26 time(s). PolyFit.pdf (749kb) downloaded 19 time(s).Best regards. Alvaro.
|
1 user thanked Razonar for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 05/06/2014(UTC) Posts: 348 Location: Colombo Was thanked: 125 time(s) in 82 post(s)
|
|
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka |
|
|
|
SMath Studio Forum
»
SMath Studio
»
Samples
»
Program for Linear and Polynomial Fit
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.