Interpolating two different size of tables

Table 1: Ts = [0.003,0.0033,0.0004,0.006.....] ; Torque =[10,20,30,40....]
Table 2 Ts1ms=[0.001,0.002,0.003,0.004,0.005......]; Torque=[????]
Expected Result
Table 3:
Ts1ms Torque
0,001 10
0,002 10
0,003 10
0.004 30
0.005 35
....
I have table 1 data. I need to find for Ts1ms data what is the torque
Based on table 2 I have to find the interpolated data from Table 1
Could someone help me with this ?
Thanks in advance

2 Comments

When you say you have your data as tables, do you really mean tables?
yes i Meant table array... It can also be a matrix.

Sign in to comment.

 Accepted Answer

REad about interp1.
Torque1ms = interp1(Ts,Torque,Ts1ms) ;

6 Comments

Thanks for your resposnse
How to handle different size of the tables/arrays
Table 1 and table 2 are indifferent sizes
Table size doe not matter, when you inteprolate. Only matters is Table 2 should lie in the bounds of table 1, x-values.
I tried with my data for smaller data i did not get any error and for bigger data i am getting this following error
Error using griddedInterpolant
The grid vectors must contain unique points
Any leads would be appreciated
Share you data and code which is giving error.
Please find the code below. ALso please find the attached data 'data.mat'
fs=1000; %sampling frequency
Ts=1/fs; %sampling time 1ms
ts=0.001:Ts:65.469; %adjusting the matrix length
X=ts*1000; %s to ms
Result=ts.'; %Transpose matrix
Result1=array2table(Result); % array to table conversion
b=Result1.Result;
New=interp1(Data.ts,Data.ENG_TRQ_AFTR_REDNm,b); %interpolated data
Any further leads would be appreciated :)

Sign in to comment.

More Answers (0)

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!