No BSD License  

Highlights from
PARabolic FILling midpoints: PARFIL

1.0

1.0 | 3 ratings Rate this file 2 Downloads (last 30 days) File Size: 9 KB File ID: #10229
image thumbnail

PARabolic FILling midpoints: PARFIL

by Vassili Pastushenko

 

05 Mar 2006 (Updated 06 Mar 2006)

Inserts mid points ito each interval of x,y data: all(diff(x)>0)=true

| Watch this File

File Information
Description

FILls midpoints into vectors/matrices by PARabolic interpolation as would do Y=interp1(x,y,X,'parabolic')with X=sort([x;( x(1:end-1)+x(2:end) )/2];
For matrices PARFIL works on columns. If only rows match length(x),
then y will be transposed.
For regular data (equidistantly sampled, i.e. std(diff(x))=0),
Y is identical with INTERPOL(y,1,DEG) in inner intervals,(completely identical for DEG=3), but INTERPOL is somewhat
faster than PARFIL

DEMO is included in help and given by
parfil()

For very smooth data results are close to that of SPLINE

For somewhat noisy data can become method of choice (better than linear, pchip or spline interpolations)

MATLAB release MATLAB 7 (R14)
Other requirements function o_o from maxall in FEX, but this is only sound and it can be deleted
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (16)
07 Mar 2006 Duane Hanselman

I doubt the usefulness of this function to many people since it claims to require all add-on products sold by TMW.
Can the description here and help text be rewritten more clearly? Right now I don't know what this function does. It seems to do some sort of interpolation. Does it do smoothing as well? Please help me out here. If I were to use this function I would want to know what it does and how it is different from other approaches.

07 Mar 2006 Vassili Pastushenko

Hi Duane!

PARFIL is submitted for those ML users who are interested in good routines. Sure, I shall be happy if there will be many such users.

All TMW products appeared occasionally, in fact none is necessary. Therefore take it easy. Next time I shall be more careful submitting a file. Help is very detailed, perhaps even more than necessary. Just try any reasonable example and judge yourself.

07 Mar 2006 Jiro Doke

I agree that the help (help text block) can be improved. It's hard to follow. Maybe it's just a formatting issue. You should not include the descriptions for Subfunctions in the main help, because it's not useful to the users.

07 Mar 2006 Jiro Doke

... and remove all of the required toolboxes. They are *not* required, and it is misleading.

07 Mar 2006 Duane Hanselman

How is your parabolic interpolation done? Given the pairs of data {x(k),y(k)} and {x(k+1),y(k+1)} where is the intermediate point you compute and how is it computed? Is added x data point (x(k)+x(k+1))/2? Is parabolic equal to quadratic, meaning a second order polynomial? If so, you have 3 parameters to find, but only two data points given. Or do you use the data pair {x(k-1),y(k-1)} or (x(k+2),y(k+2)} in some way? I know that I can run the program and that it will give me results that may be pleasing to the eye, but I do not know how those pleaseing results are computed. As a result, I am uncomfortable with them. How is this better/worse/ different than what interp1 can do? If this function is anthing like what interp1 does, the help text for interp1 is an excellent example of how to write the help text for your function. I don't know what you mean by "take it easy"? If it is important, please help me understand you.

07 Mar 2006 Vassili p

>> Is added x data point (x(k)+x(k+1))/2?
Yes. This is clearly written above. Why again asking?

 >>Is parabolic equal to quadratic, meaning a second order polynomial?

Where did you see QUADRATIC PARABOLAS as SECOND ORDER polynomials? QUADRATIC polynomials have order three and degree two. In cubic polynomials order =4, degree=3.

In internal intervals there are TWO EQUAL IN RIGHTS possibilities for QUADRATIC INTERPOLATION. I am used to respect rights. This explaines high accuracy of INTERPOL, although it works only with equally spaced data. In PARFIL
I do ONLY ONCE BOTH POSSIBLE QUADRATIC INTERPOLATIONS in every internal interval, subsequently only using these results.

In first and last intervals the story is somewhat more complicated, and, as IS WRITTEN IN HELP, I have included a trivial option for cubic interpolation ONLY IN THESE INTERVALS. By default, QUADRATIC interpolation is made even here.

Enjoy my results. I shall accept your voting for deletion, if you succeed a better QUADRATIC interpolation at the same calculational price. It is known, interpolation of any degree can be reached as repetitive linear interpolation of previous results. You don't need to suspect such cheap tricks, but it seems so.

07 Mar 2006 Duane Hanselman

                    It is clear to me that we have a language issue here. For example, I do not understand what you mean by "TWO EQUAL IN RIGHTS", "I am used to respect rights", and "QUADRATIC interpolation is made even here". Our understanding of polynomials differs and I now know what you mean by "order" and "degree". Despite your assumption to the contrary, I do not suspect you of "cheap tricks". Your code may be very well written. I have no way of knowing one way or the other. Above all else, I expect good documentation for submissions, which seems difficult to achieve here. Without an understanding of your algorithms, I am very reluctant to use your function. I will not "succeed a better QUADRATIC interpolation at the same caclulational price" because I will not attempt to duplicate what you do. Even if I wanted to, I couldn't without a tremendous amount of work since I don't know what you do.

08 Mar 2006 Vassili Pastushenko

>>It is clear to me that we have a language issue here.

A small correction: YOU have a problem, not me. And here is the proof:

>>Our understanding of polynomials differs and I now know what you mean by "order" and "degree".

Exactly this is "THE LANGUAGE PROBLEM". I use everywhere accepted definition, you have your own, apparently, a different one, as you have demonstrated. I am not going to teach you English or math. In turn, I have strong doubts that I can learn anything from you.

08 Mar 2006 Jos vdG

This code has poor documentation and lacks comments inside the script. So, it is quite unclear how to use it, what it does exactly and what you can learn from it.
Moreover, it is poorly coded, creating unnecessary variables and unneedingly using, e.g., finds and for-loops.

08 Mar 2006 Vassili Pastushenko

I don't know who is Jos. A serious remark would be: so and so % calculation time can be saved with long data by avoiding FOR or FIND. Other arguments are highly incorrect, reflecting some strange emotions. I have enough emotional "experts" here.

08 Mar 2006 John D'Errico

Calm down. Perhaps this will restore "order".
http://mathworld.wolfram.com/PolynomialOrder.html
Everywhere accepted definitions seem not to be accepted everywhere.

08 Mar 2006 Vassili Pastushenko

Hi John!

The first real expert sheding some useful light. Thanks for your citation. In fact it supports my position here. Moreover, we do not need to go too far outside ML community, and in many places ML doc uses the definition: order = number of all possible polynomial coefficients at given degree, and polynomial degree = highest degree of x, so that ORDER=DEGREE+1. Because of this strong binding I am usually relactant, which of the two could be better used. In any case, if one uses some definitions, not accepted in ML, he should have specified this at once, which is not the case. I wonder why the discussion is around some things of 1000-th importance instead of essentials, but if a question is put, I feel obliged to answer. I am finishing now based on PARFIL general quadratic interpolation (vectors or matrices) like

interp1(x,y,X,'quadratic')

with arbitrary X. Since I have published INTERPOL, which has shown a gap in interpolation, i.e. missing classical quadratic and cubic interpolations, I did hope that this gap will be closed, but to my knowledge this has still not happened.

08 Mar 2006 Duane Hanselman

I agree that I do have an language problem with your submission and comments here. For example, can you explain the terms "TWO EQUAL IN RIGHTS", "I am used to respect rights", and "QUADRATIC interpolation is made even here"? In addition, can you explain your algorithm as well? How do you take data at consecutive points and interpolate to find a new data point half way in between? I am not an expert and I assume that you would like nonexperts to use your code, so please help us nonexperts understand.

08 Mar 2006 Vassili Pastushenko

.

Hi Duane.

I can answer all your questions, but I need some time for that, not right now. I do not understand, what are your difficulties.

If you want to find the interpolated y-value in the middle of given internal interval, you can use two given x,y points, defining the interval. And you need one more point for quadratic interpolation. You can select it either before, or after the interval. Thus you have two different possibilities, and there are no general limitations which could oblige you to select one of them and ignore the second one. I have expressed this shortly as "equal in rights", which I expected to be sufficiently clear.

What I do not understand, how can one decide whether something is of some value or not without any attempt to understand, what is it. Such an aggressivity is unusual for civilized people, and it is not helpful for any real discussions.

I think, enough at the moment.

21 Nov 2007 Shaun D

Much ado about nothing. User-UNfriendly. Unclear. Bad programming. Why do something simple, when it is just as easy to do something complicated?

25 Nov 2007 V P

I see in the last days something has happened. Some unknown people claim to be experts without having compared the quality of the results with any other method of quadratic interpolation. Quadratic spline does the job better, if the points are relatively closely positioned. But I do not claim that this program is better than spline.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
approximation Vassili Pastushenko 22 Oct 2008 08:17:24
interpolation Vassili Pastushenko 22 Oct 2008 08:17:24
noisy Vassili Pastushenko 22 Oct 2008 08:17:24
data Vassili Pastushenko 22 Oct 2008 08:17:24
parabolic Vassili Pastushenko 22 Oct 2008 08:17:24
cubic Vassili Pastushenko 22 Oct 2008 08:17:24

Contact us at files@mathworks.com