Interpolate 2D-lookup table
Mostrar comentarios más antiguos
I have several curves, which describe the stiffness of a tire over the load at seven different tire pressures. Now I`m want to make a function, which interpolates between the measured data and can return the stiffness at a specific load and tire pressure. I tried the 'interp2'-function, but got the following error message:
'Error using interp2>makegriddedinterp (line 237)
Input grid is not a valid MESHGRID.'
Here is an example of my code:
close all, clear all, clc
% load [kg]
m = [
1800 2500 3200 3900 4700;
2300 3300 4250 5300 6300;
2900 4100 5300 6500 7800;
3400 4800 6200 7600 9100;
3700 5100 6600 8200 9800
];
% tire pressure [bar]
p = [
1.6 1.6 1.6 1.6 1.6;
2.4 2.4 2.4 2.4 2.4;
3.2 3.2 3.2 3.2 3.2;
4.0 4.0 4.0 4.0 4.0;
4.4 4.4 4.4 4.4 4.4;
];
% stiffness [DaN/mm]
c = [
43 45 47 48 49
58 61 63 65 66
71 74 77 80 82
84 88 91 94 96
90 94 97 100 102
];
% 3D-Plot
[mq, pq] = meshgrid(0:100:10000, 0:0.05:5);
cq = interp2(m, p, c, mq, pq);
figure;
surf(mq, pq, cq);
1 comentario
John D'Errico
el 22 de Sept. de 2020
Editada: John D'Errico
el 22 de Sept. de 2020
The array m is NOT an array that meshgrid would produce.
Therefore, you cannot use interp2.
It is also true that you will be doing some serious, significant extrapolation. So expect poor results in those regions.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
