picking numbers with specific difference in matlab
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Usama Bin Khalid
el 15 de Mzo. de 2021
Comentada: Usama Bin Khalid
el 15 de Mzo. de 2021
I have a data set...like say CAD from 212 to 550 say with a differnce of 1 and have corresponing SA values to these CAD values
But I want to pick numbers at a specific distance and in a specific sequence ..like 212,212.3,212.7,213,213.3,213.7.....so that later on i can interpolate the SA values on these CAD values.
How can i do that!! if there was single difference between numbers that would be simple as i did here picking data with a differenc of 0.5:
CAD= data(:,1);
SA= data(:,2);
CADQ=CAD(1):0.5:CAD(end);
vq = interp1 (CAD, SA, CADQ);
here i was able to pick 212,212.5,213,213.5....and was able to interpolate SA on these CAD values.
now how can i do that..picking CAD data in the sequence 212,212.3,212.7,213,213.3,213.7,214,214.3.....
1 comentario
Rik
el 15 de Mzo. de 2021
I don't understand your question well enough to answer it, but it sounds as if ismember will be helpful.
Respuesta aceptada
Steven Lord
el 15 de Mzo. de 2021
One way is to take advantage of implicit expansion.
x = 212:215;
y = [0; 0.3; 0.7];
z = reshape(x+y, 1, [])
5 comentarios
Rik
el 15 de Mzo. de 2021
Create an array where you repeat 0.3 0.5 enough times, set your starting offset as the first value and then use cumsum to calculate the cumulative sum.
x=repmat([0.3 0.5],1,5)
x(1)=213
x=cumsum(x)
Más respuestas (0)
Ver también
Categorías
Más información sobre Interpolation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!