Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add modified Akima interpolation (univariate) as known from MATLAB ≥ R2017b #3188

Merged
merged 2 commits into from
Dec 2, 2019

Conversation

beutlich
Copy link
Member

@beutlich beutlich commented Nov 1, 2019

The modified Akima interpolation (aka. Makima) avoids overshoots/undershoots and edge cases of identical slopes that are present in the original Akima method. It is documented in Cleve's corner by Cosmin Ionita from The MathWorks and also available since MATLAB R2017b.

This properly resolves #1039, which previously was closed as wontfix.

The modified Akima interpolation (aka Makima) avoids overshoots/undershoots and edge case of identical slopes that are present in the original Akima method. It is documented in https://blogs.mathworks.com/cleve/2019/04/29/makima-piecewise-cubic-interpolation/ by Cosmin Ionita from the MathWorks and also available since MATLAB R2017b.
@beutlich beutlich added enhancement New feature or enhancement L: Blocks Issue addresses Modelica.Blocks L: C-Sources Issue addresses Modelica/Resources/C-Sources labels Nov 1, 2019
@beutlich beutlich added this to the MSL4.0.0 milestone Nov 1, 2019
@beutlich beutlich self-assigned this Nov 1, 2019
Copy link
Contributor

@HansOlsson HansOlsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely comfortable with the Cosmin Ionita reference in the C-code.
Are there other references to this?

@beutlich
Copy link
Member Author

beutlich commented Nov 8, 2019

Are there other references to this?

I am afraid, there is no other publication than the makima documentation by The MathWorks (https://www.mathworks.com/help/matlab/ref/makima.html#mw_e8ee1c8c-2cc3-46c4-90c4-c3208804ff4e) and this blog post.

We could also utilize some disguising URL referrer such as https://tinyurl.com/makima-ref or https://tinyurl.com/modified-akima.

@HansOlsson
Copy link
Contributor

I am afraid, there is no other publication than the makima documentation by The MathWorks (https://www.mathworks.com/help/matlab/ref/makima.html#mw_e8ee1c8c-2cc3-46c4-90c4-c3208804ff4e) and this blog post.

To me that is concerning from a legal perspective.

@beutlich
Copy link
Member Author

beutlich commented Nov 14, 2019

I am afraid, there is no other publication than the makima documentation by The MathWorks (https://www.mathworks.com/help/matlab/ref/makima.html#mw_e8ee1c8c-2cc3-46c4-90c4-c3208804ff4e) and this blog post.

To me that is concerning from a legal perspective.

Understandable. Would it be OK for you if I directly ask Cosmin Ionita from The MathWorks about rights and permission to use makima in OSS projects?

@MartinOtter
Copy link
Member

I am afraid, there is no other publication than the makima documentation by The MathWorks (https://www.mathworks.com/help/matlab/ref/makima.html#mw_e8ee1c8c-2cc3-46c4-90c4-c3208804ff4e) and this blog post.

To me that is concerning from a legal perspective.

Understandable. Would it be OK for you if I directly ask Cosmin Ionita from The MathWorks about rights and permission to use makima in OSS projects?

This does not make sense. The blog post is a publicly available web page. From a copyright point of view neither text nor a picture is used from this blog. Only information that is publicly shared in this post is utilized. It is completely fine to use this information. It is polite to reference this blog post (https://blogs.mathworks.com/cleve/2019/04/29/makima-piecewise-cubic-interpolation/). However, the MathWorks documentation should not be referenced.

@HansOlsson
Copy link
Contributor

This does not make sense. The blog post is a publicly available web page. From a copyright point of view neither text nor a picture is used from this blog.

The copyrighted blog post is problematic since it (as far as I understand) both contain a textual description and code. We should at least make it really clear that we implemented the code based on the description in the text.

@beutlich
Copy link
Member Author

The C file has the reference to the blog post only. https://blogs.mathworks.com/cleve/2019/04/29/makima-piecewise-cubic-interpolation/#3b78d49a-0e90-4c1d-9f16-49a23a175132 are the modified formulas I used as input for the C implementation.

@MartinOtter
Copy link
Member

The C file has the reference to the blog post only. https://blogs.mathworks.com/cleve/2019/04/29/makima-piecewise-cubic-interpolation/#3b78d49a-0e90-4c1d-9f16-49a23a175132 are the modified formulas I used as input for the C implementation.

This link seems to be personalized. Please, use the following link in the description:

https://blogs.mathworks.com/cleve/2019/04/29/makima-piecewise-cubic-interpolation/

@beutlich
Copy link
Member Author

beutlich commented Nov 15, 2019

Please, use the following link in the description:

https://blogs.mathworks.com/cleve/2019/04/29/makima-piecewise-cubic-interpolation/

That link is used in the C file. What else do you mean by description?

grafik

@MartinOtter
Copy link
Member

MartinOtter commented Nov 15, 2019

Please, use the following link in the description:
https://blogs.mathworks.com/cleve/2019/04/29/makima-piecewise-cubic-interpolation/

That link is used in the C file. What else do you mean by description?

Sorry. This is what I meant. All this looks fine now.

@beutlich
Copy link
Member Author

beutlich commented Nov 15, 2019

We should at least make it really clear that we implemented the code based on the description in the text.

@HansOlsson Is the link in the C file good enough after the discussion or do you insist on an extra description in the documentation of the table blocks. (Would be a good idea anyway to have all references listed, but we do not have Modelica.Blocks.UsersGuide.References yet.)

@HansOlsson
Copy link
Contributor

We should at least make it really clear that we implemented the code based on the description in the text.

@HansOlsson Is the link in the C file good enough after the discussion or do you insist on an extra description in the documentation of the table blocks. (Would be a good idea anyway to have all references listed, but we do not have Modelica.Blocks.UsersGuide.References yet.)

I would prefer if it in some way stated that it was based on the description on that page - not the code on the same page.

@beutlich
Copy link
Member Author

Instead of

 /* Reference:
     Cosmin Ionita. Makima piecewise cubic interpolation, April 2019.
     (https://blogs.mathworks.com/cleve/2019/04/29/makima-piecewise-cubic-interpolation/)
  */

I could write

 /* Reference:
     Cosmin Ionita. Makima piecewise cubic interpolation, April 2019.
     (https://blogs.mathworks.com/cleve/2019/04/29/makima-piecewise-cubic-interpolation/)
     Note: The MATLAB code listings have not been utilized during implementation.
  */

But, too me, this looks rather odd as this note simply does not belong here when just giving the reference.

There also is an official short-link, we could use: https://blogs.mathworks.com/cleve/?p=4707

@HansOlsson
Copy link
Contributor

But, too me, this looks rather odd as this note simply does not belong here when just giving the reference.

I meant something like: "Reference - method description in: https://blogs.mathworks.com/cleve/2019/04/29/makima-piecewise-cubic-interpolation/"

I don't view it as that odd. People often give page-numbers/chapters when referencing a book.

Copy link
Contributor

@HansOlsson HansOlsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok.

@beutlich beutlich merged commit b9e98ba into modelica:master Dec 2, 2019
@beutlich beutlich deleted the add-makima-1d branch December 2, 2019 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or enhancement L: Blocks Issue addresses Modelica.Blocks L: C-Sources Issue addresses Modelica/Resources/C-Sources
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tables: CombiTimeTable with Akima spline interpolation and borderline slopes
3 participants