interpolation of data takes minutes to operate
1 view (last 30 days)
Show older comments
I have a data of 5068x59 and I want to interpolate each column with respect to column number 4. I have used the below code and its working fine. However, it takes sometime to operate. Therefore, is there any easier way to perform the below tasks
T=readmatrix('1.xlsx');
x = T(:,4) ;
for b=1:width(T)
for bb=1: length(x)
T1(bb,b)=T(bb,b)+ bb*1E-11; %to make all values unique
end
end
distanceQ = 1:max(T1(:,4)); % new distance vector with step size of 1m
for cc=1:width(T1)
speedQ = interp1(T1(:,4),T1(:,cc) , distanceQ);
filename = 'x)Data.xlsx';
writematrix(speedQ,filename,'WriteMode','append')
end
5 Comments
Mathieu NOE
on 27 Oct 2020
hi
glad it helped you
I believe the ouput of the interp1 function is a row vector because distanceQ must also be a row vector
you must change the orientation of distanceQ , by putting distanceQ(:) instead of distanceQ in the interp1 function call
so this should give the correct orientation for speedQ:
speedQ(:,cc)= interp1(T2(:,4),T2(:,cc) , distanceQ(:));
Answers (0)
See Also
Categories
Find more on Interpolation 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!