How do I align two vectors similar to that done in plot?
Mostrar comentarios más antiguos
I have two sets of corresponding vectors that I want to compare. The first set of vectors contain pixel intensity values for every frame Int(F), and the second set contain wavelengths of light (wvLngth(F)). From these vectors I want to produce a third vector that is pixel intensity in terms of wavelength Int(wvLngth). The problem is that vectors containing the wavelengths do not start and end at the same wavelength, nor do the wavelengths increase at the same rate.
For example:
int1Data = [1 2 3 4];
int2Data = [5 6 7 8];
wvLngth1Data = [7 9 10 11];
wvLngth2Data = [9 10 11 13];
%I can plot these two together to align them but how can I add them in the way they are plotted?
figure
plot(wvLngth1Data, int1Data);
hold on
plot(wvLngth2Data, int2Data);
%I'd like to produce something like:
intAvg = [1 3.5 4.5 5.5 8]
wvLngthComb = [7 9 10 11 13]
figure
plot(wvLngthComb, intAvg);
I've looked at things to align or interpolate the data, but I don't think I can align my data set just at the start, because the middle or end would be wrong, and I don't need Matlab to interperet what it things the missing points should be either.
Thanks in advance.
2 comentarios
Jan
el 11 de Jun. de 2019
There is no "Int(F)" in the code.
Let my summarize: You have two vectors with data, whose indices are not related to each other. Now you want to find the relation between the indeces. Based on the currently given information it looks, like there is no such relation and in consequence the job cannot be solved.
Do you have additional information about how to align the data?
Jason Powell
el 11 de Jun. de 2019
Respuesta aceptada
Más respuestas (1)
Guillaume Erny
el 7 de Mzo. de 2021
Editada: Guillaume Erny
el 7 de Mzo. de 2021
0 votos
Hi Jason,
I always use this function when I want to compare spectroscopic date with different axes and it work perfectly
Categorías
Más información sobre Fourier Analysis and Filtering en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!