# How to interpolate 3 matrices?

4 views (last 30 days)
federico gentile on 2 Dec 2021
Answered: Mathieu NOE on 2 Dec 2021
Hello everybody,
I have acquired data from testing an electric motor on a test bench. The data is organized in 3 matrices, one matrix for rpm, one for motor torque and one for efficiency. The motor was controlled by arduino and the test consisted on forcing an acceleration ramp at different slopes. The matrices have a size of 5326X15 where each column correspond to a ramp. I am seeking a way to create a grid of rpm and torque and interpolate the efficiency values at those grid points.

Mathieu NOE on 2 Dec 2021
hello Federico
this is my suggestion : I give a given RPM target value and serach for all points in the 2D array that are close to this value (with a given tolerance); then I can plot the same coordinate points from the torque and efficiency curves
the second figure I added a bit of smoothing
example for RPM = 3000 rpm_tol = 1;
rpm_target = 3000;
[row, column] = find(abs(rpm-rpm_target) < rpm_tol);
rpm_values = rpm(sub2ind(size(rpm), row, column));
C_mot_values = C_mot(sub2ind(size(C_mot), row, column));
eta_mech_values = eta_mech(sub2ind(size(eta_mech), row, column));
figure,
subplot(311),plot(rpm_values);
ylabel('RPM');
subplot(312),plot(C_mot_values);
ylabel('Torque');
subplot(313),plot(eta_mech_values);
ylabel('Efficiency');
figure,
meth = 'gaussian';
N = 10;
subplot(311),plot(smoothdata(rpm_values,meth,N));
ylabel('RPM');
subplot(312),plot(smoothdata(C_mot_values,meth,N));
ylabel('Torque');
subplot(313),plot(smoothdata(eta_mech_values,meth,N));
ylabel('Efficiency');