New - X 0:0.2:5 New - y Interp1 (X, Y, New - X) Disp ( (New - X' New - Y') )
New - X 0:0.2:5 New - y Interp1 (X, Y, New - X) Disp ( (New - X' New - Y') )
clc
x=0:5
y=[15 , 10, 9, 6, 2, 0];
>> new_x=0:0.2:5;
>> new_y=interp1(x,y,new_x);
>> disp([new_x' new_y'])
>> plot(new_x,new_y)
>> hold on
>> plot(new_x,new_y,'or')
>> interp1(x,y,3.5,'spline')
ans =
3.9417
>> new_x=0:0.2:5;
>> New_y_spline=interp1(x,y,new_x,'spline');
>> plot(new_x,New_y_spline)
>> plot(new_x,New_y_spline,'or')
clear all
clc
%aplivacion a la termodinamica
T=[100, 150, 200, 250, 300, 400, 500];
u=[2506.7, 2582.8, 2658.1, 2733.7, 2810.4, 2967.9, 3131.6];
newu=interp1(T,u,215);
newT=interp1(u,T,2600);
>> plot(T,u)
>> hold on
>> plot(215,newu,'or')
clear all
clc
%aplicacion 2 termodinamica
T=[100, 150, 200, 250, 300, 400, 500]';
v=[1.6958, 1.9364, 2.172, 2.406, 2.639, 3.103, 3.565]';
u=[2506.7, 2582.8, 2658.1, 2733.7, 2810.4, 2967.9, 3131.6]';
h=[2676.2, 2776.4, 2875.3, 2974.3, 3074.3, 3278.2, 3488.1]';
props=[v,u,h];
newT=[100:25:500]';
newprop=interp1(T,props,newT);
disp('propieddades de vapor a 0.1MPa')
disp('Temp Speeicifica del volume internal Energy Enthalpy')
disp('
C
m^3/Kg
K3/kg
K3/Kg')
fprintf('%6.0f %10.4f %8.1f %8.1f\n',[newT,newprop]')
clear all
clc
y=2:2:6;
x=1:4;
z=[7 15 22 30
54 109 164 218
413 807 1210 1614];
new_z=interp1(y,z,3)
new_z =
30.5000 62.0000 93.0000 124.0000
>> new_z2=interp1(x,new_z,1.5)
new_z2 =
46.2500
>> interp2(x,y,z,1.5,3)
ans =
46.2500
clear all
clc
x=0:5;
y=[15, 10, 9, 6, 2, 0];
smooth_x=0:0.2:5;
smooth_y2=0.0536*smooth_x.^2-3.182*smooth_x+14.4643;
subplot(1,2,1)
plot(x,y,'o',smooth_x,smooth_y2)
smooth_y3=-0.0648*smooth_x.^3+0.5398*smooth_x.^2-4.0701*smooth_x+14.6587;
subplot(1,2,2)
plot(x,y,'o',smooth_x,smooth_y3)