How To Use Polunomial Interpolation?

1 view (last 30 days)
Zahra kamkar
Zahra kamkar on 4 Sep 2014
Commented: John D'Errico on 9 Sep 2014
Hi. I have a big problem. I wanna normalize some sub-sequences with varied length into identical length by the Polynomial Interpolation. my data is some 0 and 1 that are put in a structure.
For instance: Chromosome.Position=[1001][10101][101][100001]....
Could anyone help me?

Answers (1)

John D'Errico
John D'Errico on 4 Sep 2014
Edited: John D'Errico on 4 Sep 2014
I think you need to either explain what you mean by interpolation in this context, or figure out what you mean yourself, as it is completely unclear how you intend to interpolate such a sequence. Very often when someone asks a question that is so unclear, it means they do not themselves understand what they are trying to do.
That is, interpolation of integer values will tend to produce non-integers at intermediate points. What does a non-integer mean in this context? So is your goal to take the pair of sequences:
[1001] [10101]
and make them both of length 5? What would you expect to see?
  2 Comments
Zahra kamkar
Zahra kamkar on 5 Sep 2014
Thanks so much for your reply. To be frank, I myself can't understand how I can use interpolation here! But as I said, I just need to make the length of my sequences identical. Its not important whether it becomes non-integer or not. Yes, I wanna make the length of all my sequences for example, 5.
John D'Errico
John D'Errico on 9 Sep 2014
Anyway, polynomial interpolation is an INSANE idea here. Polynomials will tend to give numbers that are wildly outside the range [0,1], not even just non-integers. You are far better off using interp1 instead. I would suggest the linear method as simplest. For example...
P1 = [1 0 0 1];
X1 = linspace(1,5,numel(P1));
P1int = interp1(X1,P1,1:5)
P1int =
1 0.25 0 0.25 1
Which is as good as you can expect. Even so, The whole idea seems silly if these are suppose to be genetic in origin.

Sign in to comment.

Categories

Find more on Polynomials in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!