Professional Documents
Culture Documents
Interpolacion Sobre Superficies Planas
Interpolacion Sobre Superficies Planas
x=
0.5000
2.2500
3.1000
1.1000
0.5000
>> y=[y1;y2;y3;y4;y1]
y=
0
1.3000
2.7000
2.0000
0
>> plot(x,y,'ro')
>> hold on
>> plot(x,y,'b')
>> grid
>> syms s t
>> N1=(s-1)*(t-1)/((-1-1)*(-1-1))
N1 =
>> N2=(s+1)*(t-1)/((-1+1)*(-1-1))
N2 =
Inf
>> N2=(s+1)*(t-1)/((1+1)*(-1-1))
N2 =
>> N3=(s+1)*(t+1)/((1+1)*(1+1))
N3 =
>> N4=(s-1)*(t+1)/((-1-1)*(1+1))
N4 =
>> f=[10;30;50;40]
f=
10
30
50
40
P=
(5*(s - 1)*(t - 1))/2 - 10*(s - 1)*(t + 1) - (15*(s + 1)*(t - 1))/2 + (25*(s + 1)*(t
+ 1))/2
>> P=expand(P)
P=
>> P=simplify(P)
P=
>> pretty
??? Undefined function or variable 'pretty'.
>> pretty(P)
15 s 25 t 5 s t 65
---- + ---- - ----- + -2
>> subs(P,{s,t},{-1,-1})
ans =
10
>> subs(P,{s,t},{1,-1})
ans =
30
>> subs(P,{s,t},{1,1})
ans =
50
>> subs(P,{s,t},{-1,1})
ans =
40
>> xst=N1*x1+N2*x2+N3*x3+N4*x4
xst =
((s - 1)*(t - 1))/8 - (11*(s - 1)*(t + 1))/40 - (9*(s + 1)*(t - 1))/16 + (31*(s +
1)*(t + 1))/40
>> yst=N1*y1+N2*y2+N3*y3+N4*y4
yst =
>> subs(xst,{s,t},{-1,-1})
ans =
0.5000
>> subs(yst,{s,t},{-1,-1})
ans =
>> [s,t]=solve('((s - 1)*(t - 1))/8 - (11*(s - 1)*(t + 1))/40 - (9*(s + 1)*(t 1))/16 + (31*(s + 1)*(t + 1))/40=1.5','(27*(s + 1)*(t + 1))/40 - (13*(s + 1)*(t
- 1))/40 - ((s - 1)*(t + 1))/2=1.5')
s=
3.6926242452724523406025203994076
-0.31807879072699779514797494486218
t=
-6.2353003921507232189865878478901
0.17716085726700228875402970835523
>> vpa(s,5)
ans =
3.6926242452724523406025203994076
-0.31807879072699779514797494486218
>> vpa(t,5)
ans =
-6.2353003921507232189865878478901
0.17716085726700228875402970835523
>> syms s t
>> P
P=
>> SUBS(P,{s,t},{-0.3181,0.1772})
Warning: Could not find an exact (case-sensitive) match for 'SUBS'.
C:\Program Files (x86)\MATLAB\R2010a\toolbox\symbolic\symbolic\subs.m is
a
case-insensitive match and will be used instead.
You can improve the performance of your code by using exact
name matches and we therefore recommend that you update your
usage accordingly. Alternatively, you can disable this warning using
warning('off','MATLAB:dispatcher:InexactCaseMatch').
This warning will become an error in future releases.
ans =
32.4702
>> subs(P,{s,t},{-0.3181,0.1772})
ans =
32.4702
>> clear all
>> % interpolacion sobre elemntos triangulares
>> x1=1;y1=1;x2=5;y2=2;x3=3;y3=4;
>> f1=50;f2=70;;f3=90;
>> x=[x1;x2;x3;x1]
x=
1
5
3
1
>> y=[y1;y2;y3;y1]
y=
2
4
1
>> f=[f1;f2;f3]
f=
50
70
90
>> plot(x,y,'ro')
>> hold on
>> plot(x,y,'b')
>> grid
>> syms X Y
>> A=[1 1 1;1 5 2;1 3 4]
A=
>> B=[50;70;90]
B=
50
70
90
>> C=inv(A)*B
C=
36
2
12
>> p=36+2*X+12*Y
p=
2*X + 12*Y + 36
>> X=1;Y=1;
>> p=36+2*X+12*Y
p=
50
>> X=5;Y=2;
>> p=36+2*X+12*Y
p=
70
>> X=3;Y=4;
>> p=36+2*X+12*Y
p=
90
>> X=3;Y=2.5;
>> p=36+2*X+12*Y
p=
72
>>