How to flip or mirror some vector parts

Hi,
I have a data that has flipped on me. I need to correct for this but I am not sure how to do this. The data is in vector form.
I need to somehow invert the data to become a rectangle form, see red line in photo above. I looked at flipud, and other functions like that but I can't get the it turned correctly.
How can I do this? Attaching the vector.
Many thanks!

4 comentarios

pfb
pfb el 12 de Abr. de 2015
But how can the blue line become the red one just by flipping it or a portion of it? Even after flipping, the curves will be different.
And anyway, isn't this the very definition of "data doctoring"?
I think you should perhaps focus on the reason why your data flipped on you, whatever that means.
Lizan
Lizan el 12 de Abr. de 2015
The line is not suppose to turn downwards after the "fake" peak in that line. Unfortunately I cannot change this since this happened randomly in the measurement due to some unknown factor. I have to reconstruct the "shape". I do know however that the line was suppose to continue up to a top level and then after a short while turn down again to the original baseline.That is usually what I obtain here. Since this one is now following the said shape I cannot process the data for my calculations thereafter. If you mirror it you see that it would continue upward and then turn down again.
pfb
pfb el 12 de Abr. de 2015
Editada: pfb el 12 de Abr. de 2015
But what exactly is what you want to "flip"?
In flipud (or fliplr), up and down (or left and right) refer to the vector, irrespective of the data it contains. That is, if v = [1 2 3 4] then fliplr(v)=[4 3 2 1]. Also flipud(v) would produce v itself, because v is a row, and flipud works along columns.
I do not think that flipping alone would do the trick.
Lizan
Lizan el 12 de Abr. de 2015
Editada: Lizan el 12 de Abr. de 2015
Well I guess I am not looking for flipping. Somehow I want the line to continue up rather than turning down. Not sure what word I am looking for or what is called...
I just want to have that part that is going down to continue up.

Iniciar sesión para comentar.

 Respuesta aceptada

pfb
pfb el 12 de Abr. de 2015
Editada: pfb el 12 de Abr. de 2015
From the shape of your curve, I guess that you might get roughly the shape you need by setting
yd = (y+fliplr(y))/2
where I'm assuming that your "raw" vector y is a row. Change fliplr into flipud if it is a column (or transpose y).
But then I'm not sure that the data you're getting would have any meaning.
Update: Actually I think that my solution gives something similar to the red curve, but the plateau would be below the baseline.
I took a look at the data you attach, which covers the part from the second to the third curve in your plot. Your vector is a column, so flipud should apply.
Perhaps what you are looking for is
yd = (y+flipud(y))/2;
b = yd(1); % this should roughly be the baseline value
yd = -(yd-b)+b;
In the last line I change the sign of yd after subtracting the baseline, so that the plateau is on top of the baseline (which now is 0) and add the baseline again.
This should give roughly the shape you're looking for, if y is the whole data you used in the plot (not only what you attach).
I have strong doubts about any data analysis based on yd, though.

2 comentarios

Lizan
Lizan el 12 de Abr. de 2015
Editada: Lizan el 12 de Abr. de 2015
Yes, thank you! That is what I was looking for.
I only need the total amplitude of the curve. This is the result from an interferometer.. So I am looking for the phase shift. I am going to transform this curve to the phase change.
pfb
pfb el 12 de Abr. de 2015
You're welcome. Can you accept the answer, if it works for you?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Mathematics en Centro de ayuda y File Exchange.

Productos

Etiquetas

Preguntada:

el 12 de Abr. de 2015

Comentada:

pfb
el 12 de Abr. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by