Hi all,
I have a column vector RPM_c, where I want to split it to elements below and above the vector's mean value, perform a different operation in the two respective groups of elements, and place them back to their original position as found RPM_c.
I know how to do everything, except for the last part of placing them in their original position. For example:
RPM_c = [m x 1] ; %an m x 1 matrix
%Find elements above and below the mean
RPM_L = RPM_c(RPM_c < mean(RPM_c)) ; RPM_H = RPM_c(RPM_c > mean(RPM_c)) ; %Perform any desired operation on these elements
%(it could be anything, for this example I choose to smooth & multiply the two groups respectively)
RPM_Ls = smooth(RPM_L, 'rlowess') ; RPM_Hs = RPM_H * 1.16 ;
Now I need to place RPM_Ls and RPM_Hs back in their original order, as found in vector RPM_c. How could I do this? I am trying to avoid sorting the data. I know this would be easier, however it is of importance in this case that they remain with their current order.
Thanks for your help in advance,
KMT.
Best Answer