Interpolation input grid is not a valid meshgrid
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Thom Nelissen
le 21 Déc 2021
Modifié(e) : Stephen23
le 21 Déc 2021
Hi,
I'm quite new to MATLAB and i can't figure out what i'm doing wrong.
omega=... % speed in rad/s
((1/3.6)/0.0625)*[2 2 2 2 2;
4 4 4 4 4;
6 6 6 6 6;
8 8 8 8 8;
10 10 10 10 10;
12 12 12 12 12;
14 14 14 14 14;
16 16 16 16 16;
18 18 18 18 18;
20 20 20 20 20;
22 22 22 22 22;
24 24 24 24 24;
26 26 26 26 26;
28 28 28 28 28;
30 30 30 30 30;
32 32 32 32 32;
34 34 34 34 34;
36 36 36 36 36;
38 38 38 38 38];
torque=... % torque in Nm
0.04*[5 7 10 13 15 ;
5 7 10 13 15 ;
5 7 10 13 15 ;
5 7 10 13 15 ;
5 7 10 13 15 ;
5 7 10 13 15 ;
5 7 10 13 15 ;
5 7 10 13 15 ;
5 7 10 13 15 ;
5 7 10 13 15 ;
5 7 10 13 15 ;
5 7 10 13 15 ;
5 7 10 13 15 ;
5 7 10 13 15 ;
5 7 10 13 15 ;
5 7 10 13 15 ;
5 7 10 13 15 ;
5 7 10 13 15 ;
5 7 10 13 15 ];
eta=... % measured efficiency
[0.1025 0.1440 0.1824 0.2076 0.2190 ;
0.1338 0.1929 0.2463 0.2804 0.2975 ;
0.1461 0.2147 0.2790 0.3267 0.3378 ;
0.1246 0.2255 0.2658 0.3470 0.3414 ;
0.1380 0.2254 0.2919 0.3724 0.3691 ;
0.1427 0.2501 0.3000 0.3840 0.5545 ;
0.3453 0.4437 0.5122 0.3896 0.5680 ;
0.3439 0.4464 0.5247 0.3944 0.5810 ;
0.3435 0.4549 0.5319 0.3968 0.5883 ;
0.3487 0.4659 0.5449 0.4005 0.6039 ;
0.3462 0.2500 0.5521 0.4071 0.6104 ;
0.1481 0.2423 0.3356 0.4058 0.4239 ;
0.1495 0.2480 0.3382 0.4070 0.4213 ;
0.1491 0.2491 0.3359 0.4097 0.4186 ;
0.1516 0.2531 0.3456 0.4122 0.4195 ;
0.1514 0.2573 0.3478 0.4330 0.4042 ;
0.1507 0.2584 0.3532 0.4232 0.3923 ;
0.1523 0.2582 0.3540 0.4252 0.3999 ;
0.1463 0.2617 0.3572 0.4267 0.4923 ];
%Interpolate to refine data
[omega_q , torque_q]=meshgrid ((((1/3.6)/0.0625)*2):((1/3.6)/0.0625):(((1/3.6)/0.0625)*38), (5*0.04):0.04:(15*0.04)); % set refined points
eta_q=interp2(omega, torque , eta , omega_q , torque_q, 'cubic'); % do cubic interpolation
I know I defined the meshgrid in a really weird way. But i just don't know what to do. If someone could help I would be really gratefull.
Thanks in advance!
Thom Nelissen
0 commentaires
Réponse acceptée
Stephen23
le 21 Déc 2021
Modifié(e) : Stephen23
le 21 Déc 2021
You mixed up the dimensions. This follows the explanation and examples in the INTERP2 documentation:
omega = ((1/3.6)/0.0625)*[2,2,2,2,2;4,4,4,4,4;6,6,6,6,6;8,8,8,8,8;10,10,10,10,10;12,12,12,12,12;14,14,14,14,14;16,16,16,16,16;18,18,18,18,18;20,20,20,20,20;22,22,22,22,22;24,24,24,24,24;26,26,26,26,26;28,28,28,28,28;30,30,30,30,30;32,32,32,32,32;34,34,34,34,34;36,36,36,36,36;38,38,38,38,38]
torque = 0.04*[5,7,10,13,15;5,7,10,13,15;5,7,10,13,15;5,7,10,13,15;5,7,10,13,15;5,7,10,13,15;5,7,10,13,15;5,7,10,13,15;5,7,10,13,15;5,7,10,13,15;5,7,10,13,15;5,7,10,13,15;5,7,10,13,15;5,7,10,13,15;5,7,10,13,15;5,7,10,13,15;5,7,10,13,15;5,7,10,13,15;5,7,10,13,15]
eta = [0.1025,0.1440,0.1824,0.2076,0.2190;0.1338,0.1929,0.2463,0.2804,0.2975;0.1461,0.2147,0.2790,0.3267,0.3378;0.1246,0.2255,0.2658,0.3470,0.3414;0.1380,0.2254,0.2919,0.3724,0.3691;0.1427,0.2501,0.3000,0.3840,0.5545;0.3453,0.4437,0.5122,0.3896,0.5680;0.3439,0.4464,0.5247,0.3944,0.5810;0.3435,0.4549,0.5319,0.3968,0.5883;0.3487,0.4659,0.5449,0.4005,0.6039;0.3462,0.2500,0.5521,0.4071,0.6104;0.1481,0.2423,0.3356,0.4058,0.4239;0.1495,0.2480,0.3382,0.4070,0.4213;0.1491,0.2491,0.3359,0.4097,0.4186;0.1516,0.2531,0.3456,0.4122,0.4195;0.1514,0.2573,0.3478,0.4330,0.4042;0.1507,0.2584,0.3532,0.4232,0.3923;0.1523,0.2582,0.3540,0.4252,0.3999;0.1463,0.2617,0.3572,0.4267,0.4923]
%Interpolate to refine data
V1 = (5*0.04):0.04:(15*0.04);
V2 = ((1/3.6)/0.0625)*2:(1/3.6)/0.0625:((1/3.6)/0.0625)*38;
[torque_q,omega_q] = meshgrid(V1, V2) % swap the order here !!!!
eta_q = interp2(torque, omega, eta, torque_q, omega_q, 'spline') % do cubic interpolation
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Interpolation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!