interpolation between two curves
Afficher commentaires plus anciens

Hi, I'd like to do an interpolation to draw three curves between curves of 900 and 1100K. the curves I need are at 950,1000,1050K. thanks,
Réponses (2)
INTERP1 should work well here,
A =[ NaN 900 1100 1500
-2 -4.4175 -5.1954 -6.1525
-1 -4.3845 -5.186 -6.1478
-0.02 -4.0357 -5.186 -6.1525
0 -2.0603 -5.1624 -6.1525
0.02 -1.2729 -5.1389 -6.1525
0.04 -1.0136 -5.0776 -6.1525
0.06 -0.88162 -4.9408 -6.1525
0.08 -0.7779 -4.2667 -6.1525
1 -0.70718 -3.1823 -6.1525
1.02 -0.69304 -2.923 -6.1289
1.06 -0.65061 -2.6873 -6.0346
1.08 -0.64589 -3.088 -5.7753
2 -0.63175 -2.5694 -5.219
2.02 -0.61289 -2.5459 -4.9267
2.06 -0.61289 -2.5223 -4.6674
3 -0.61289 -2.4846 -4.5495]
T=[900,950,1000,1050,1100,1500];
Anew =[[nan,T]; [A(2:end,1),...
interp1([900,1100,1500],A(2:end,2:end).',T).']];
Andrei Bobrov
le 15 Fév 2016
Modifié(e) : Andrei Bobrov
le 15 Fév 2016
Let A your data:
A =[ NaN 900 1100 1500
-2 -4.4175 -5.1954 -6.1525
-1 -4.3845 -5.186 -6.1478
-0.02 -4.0357 -5.186 -6.1525
0 -2.0603 -5.1624 -6.1525
0.02 -1.2729 -5.1389 -6.1525
0.04 -1.0136 -5.0776 -6.1525
0.06 -0.88162 -4.9408 -6.1525
0.08 -0.7779 -4.2667 -6.1525
1 -0.70718 -3.1823 -6.1525
1.02 -0.69304 -2.923 -6.1289
1.06 -0.65061 -2.6873 -6.0346
1.08 -0.64589 -3.088 -5.7753
2 -0.63175 -2.5694 -5.219
2.02 -0.61289 -2.5459 -4.9267
2.06 -0.61289 -2.5223 -4.6674
3 -0.61289 -2.4846 -4.5495]
[X,Y] = ndgrid(A(2:end,1),A(1,2:end));
F = griddedInterpolant(X,Y,A(2:end,2:end),'cubic');
use:
x = 0; % log(P)
y = 1000; % T = 1000 K
out = F(x,y)
6 commentaires
rana saleh
le 15 Fév 2016
rana saleh
le 15 Fév 2016
Andrei Bobrov
le 15 Fév 2016
Modifié(e) : Andrei Bobrov
le 15 Fév 2016
Example (full code):
A =[ NaN 900 1100 1500
-2 -4.4175 -5.1954 -6.1525
-1 -4.3845 -5.186 -6.1478
-0.02 -4.0357 -5.186 -6.1525
0 -2.0603 -5.1624 -6.1525
0.02 -1.2729 -5.1389 -6.1525
0.04 -1.0136 -5.0776 -6.1525
0.06 -0.88162 -4.9408 -6.1525
0.08 -0.7779 -4.2667 -6.1525
1 -0.70718 -3.1823 -6.1525
1.02 -0.69304 -2.923 -6.1289
1.06 -0.65061 -2.6873 -6.0346
1.08 -0.64589 -3.088 -5.7753
2 -0.63175 -2.5694 -5.219
2.02 -0.61289 -2.5459 -4.9267
2.06 -0.61289 -2.5223 -4.6674
3 -0.61289 -2.4846 -4.5495]
[X,Y] = ndgrid(A(2:end,1),A(1,2:end));
F = griddedInterpolant(X,Y,A(2:end,2:end),'cubic');
log_P = -3:.5:3; % log(P)
T = 900:50:1100;
[P,T_arr] = ndgrid(log_P,T);
out = F(P,T_arr);
plot(log_P(:),out);
rana saleh
le 15 Fév 2016
Andrei Bobrov
le 15 Fév 2016
my typo, corrected
rana saleh
le 15 Fév 2016
Catégories
En savoir plus sur Interpolation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

