what will be code for finding value of y1,y2,yy1,yy2 for x= 2.08,2.085 exactly from arbitrary data set given as?

2 visualizaciones (últimos 30 días)
what will be value of y1,y2,yy1,yy2 for x= 2.08,2.085 exactly from arbitrary
data set given as?
x=[2.07948
2.08032
2.08115
2.08199
2.08283
2.08366
2.0845
2.08534
2.08618
2.08702
];
>> y1=[0.098711
0.09832
0.098476
0.098535
0.098535
0.098486
0.098525
0.098642
0.098437
0.098515
];
>> y2=[0.083623
0.083808
0.083508
0.083784
0.08375
0.083689
0.083662
0.083545
0.08354
0.083674
];
>> yy1=[0.153781
0.153608
0.153535
0.153606
0.153803
0.153527
0.153359
0.153215
0.153537
0.153967
];
>> yy2=[0.174209
0.174162
0.174758
0.174834
0.174614
0.174465
0.174602
0.174633
0.174755
0.174572
];
>> figure;
subplot(2,1,1);
hold on;
plot(x,y1, 'r');
plot(x,y2, 'g');
hold off;
subplot(2,1,2);
hold on;
plot(x,yy1, 'r');
plot(x,yy2, 'g');
hold off;
>> set(gca, 'xcolor' ,[1 1 1] ,'xtick' ,[])

Respuestas (1)

dpb
dpb el 24 de Jul. de 2013
Editada: dpb el 24 de Jul. de 2013
doc interp1
>> [x y1 y2 yy1 yy2]
ans =
2.0795 0.0987 0.0836 0.1538 0.1742
2.0803 0.0983 0.0838 0.1536 0.1742
2.0812 0.0985 0.0835 0.1535 0.1748
2.0820 0.0985 0.0838 0.1536 0.1748
2.0828 0.0985 0.0838 0.1538 0.1746
2.0837 0.0985 0.0837 0.1535 0.1745
2.0845 0.0985 0.0837 0.1534 0.1746
2.0853 0.0986 0.0835 0.1532 0.1746
2.0862 0.0984 0.0835 0.1535 0.1748
2.0870 0.0985 0.0837 0.1540 0.1746
>> interp1(x,[y1 y2 yy1 yy2],[2.08,2.085])
ans =
0.0985 0.0837 0.1537 0.1742
0.0986 0.0836 0.1533 0.1746
>> format long
>> interp1(x,[y1 y2 yy1 yy2],[2.08,2.085])
ans =
0.098468952380952 0.083737523809524 0.153673904761905 0.174179904761905
0.098594642857143 0.083592357142857 0.153273285714286 0.174620452380952
>>

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by