a=2
a =
2
b=1
b =
1
val=(a==b)
val =
0
res=1/(a-b+val)
res =
1
a=1
a =
1
val=(a==b)
val =
1
res=(1-val)/(a-b+val)
res =
0
uiopen('/home/accounts/personale/clrmrc90/aa1213/advanced_numerical_analysis/BSplineEval.m', true);
clear all
a{1}{1}=rand(2)
a =
{1x1 cell}
a{1}{2}=rand(2)
a =
{1x2 cell}
t=[0,0,1,2,3,3];
xx=linspace(0,1);
BSplineEval(2,t,xx)
??? Input argument "xx" is undefined.
Error in ==> BSplineEval at 2
yy = zeros(size(xx));
BSplineEval(2,t,xx)
ans =
Columns 1 through 2
[1x100 double] [1x100 double]
Columns 3 through 4
[1x100 double] [1x100 double]
Column 5
[1x100 double]
BSplineEval(2,2,t,xx)
ans =
Columns 1 through 5
0 0.0101 0.0202 0.0303 0.0404
Columns 6 through 10
0.0505 0.0606 0.0707 0.0808 0.0909
Columns 11 through 15
0.1010 0.1111 0.1212 0.1313 0.1414
Columns 16 through 20
0.1515 0.1616 0.1717 0.1818 0.1919
Columns 21 through 25
0.2020 0.2121 0.2222 0.2323 0.2424
Columns 26 through 30
0.2525 0.2626 0.2727 0.2828 0.2929
Columns 31 through 35
0.3030 0.3131 0.3232 0.3333 0.3434
Columns 36 through 40
0.3535 0.3636 0.3737 0.3838 0.3939
Columns 41 through 45
0.4040 0.4141 0.4242 0.4343 0.4444
Columns 46 through 50
0.4545 0.4646 0.4747 0.4848 0.4949
Columns 51 through 55
0.5051 0.5152 0.5253 0.5354 0.5455
Columns 56 through 60
0.5556 0.5657 0.5758 0.5859 0.5960
Columns 61 through 65
0.6061 0.6162 0.6263 0.6364 0.6465
Columns 66 through 70
0.6566 0.6667 0.6768 0.6869 0.6970
Columns 71 through 75
0.7071 0.7172 0.7273 0.7374 0.7475
Columns 76 through 80
0.7576 0.7677 0.7778 0.7879 0.7980
Columns 81 through 85
0.8081 0.8182 0.8283 0.8384 0.8485
Columns 86 through 90
0.8586 0.8687 0.8788 0.8889 0.8990
Columns 91 through 95
0.9091 0.9192 0.9293 0.9394 0.9495
Columns 96 through 100
0.9596 0.9697 0.9798 0.9899 1.0000
x = linspace(0,1,11);
y = linspace(2,4,21);
[X,Y] = meshgrid(x,y);
f = @(x,y) x.^2.*y.^3;
Z = f(X,Y);
mesh(X,Y,Z)
x
x =
Columns 1 through 5
0 0.1000 0.2000 0.3000 0.4000
Columns 6 through 10
0.5000 0.6000 0.7000 0.8000 0.9000
Column 11
1.0000
y
y =
Columns 1 through 5
2.0000 2.1000 2.2000 2.3000 2.4000
Columns 6 through 10
2.5000 2.6000 2.7000 2.8000 2.9000
Columns 11 through 15
3.0000 3.1000 3.2000 3.3000 3.4000
Columns 16 through 20
3.5000 3.6000 3.7000 3.8000 3.9000
Column 21
4.0000
X
X =
Columns 1 through 5
0 0.1000 0.2000 0.3000 0.4000
0 0.1000 0.2000 0.3000 0.4000
0 0.1000 0.2000 0.3000 0.4000
0 0.1000 0.2000 0.3000 0.4000
0 0.1000 0.2000 0.3000 0.4000
0 0.1000 0.2000 0.3000 0.4000
0 0.1000 0.2000 0.3000 0.4000
0 0.1000 0.2000 0.3000 0.4000
0 0.1000 0.2000 0.3000 0.4000
0 0.1000 0.2000 0.3000 0.4000
0 0.1000 0.2000 0.3000 0.4000
0 0.1000 0.2000 0.3000 0.4000
0 0.1000 0.2000 0.3000 0.4000
0 0.1000 0.2000 0.3000 0.4000
0 0.1000 0.2000 0.3000 0.4000
0 0.1000 0.2000 0.3000 0.4000
0 0.1000 0.2000 0.3000 0.4000
0 0.1000 0.2000 0.3000 0.4000
0 0.1000 0.2000 0.3000 0.4000
0 0.1000 0.2000 0.3000 0.4000
0 0.1000 0.2000 0.3000 0.4000
Columns 6 through 10
0.5000 0.6000 0.7000 0.8000 0.9000
0.5000 0.6000 0.7000 0.8000 0.9000
0.5000 0.6000 0.7000 0.8000 0.9000
0.5000 0.6000 0.7000 0.8000 0.9000
0.5000 0.6000 0.7000 0.8000 0.9000
0.5000 0.6000 0.7000 0.8000 0.9000
0.5000 0.6000 0.7000 0.8000 0.9000
0.5000 0.6000 0.7000 0.8000 0.9000
0.5000 0.6000 0.7000 0.8000 0.9000
0.5000 0.6000 0.7000 0.8000 0.9000
0.5000 0.6000 0.7000 0.8000 0.9000
0.5000 0.6000 0.7000 0.8000 0.9000
0.5000 0.6000 0.7000 0.8000 0.9000
0.5000 0.6000 0.7000 0.8000 0.9000
0.5000 0.6000 0.7000 0.8000 0.9000
0.5000 0.6000 0.7000 0.8000 0.9000
0.5000 0.6000 0.7000 0.8000 0.9000
0.5000 0.6000 0.7000 0.8000 0.9000
0.5000 0.6000 0.7000 0.8000 0.9000
0.5000 0.6000 0.7000 0.8000 0.9000
0.5000 0.6000 0.7000 0.8000 0.9000
Column 11
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
Y
Y =
Columns 1 through 5
2.0000 2.0000 2.0000 2.0000 2.0000
2.1000 2.1000 2.1000 2.1000 2.1000
2.2000 2.2000 2.2000 2.2000 2.2000
2.3000 2.3000 2.3000 2.3000 2.3000
2.4000 2.4000 2.4000 2.4000 2.4000
2.5000 2.5000 2.5000 2.5000 2.5000
2.6000 2.6000 2.6000 2.6000 2.6000
2.7000 2.7000 2.7000 2.7000 2.7000
2.8000 2.8000 2.8000 2.8000 2.8000
2.9000 2.9000 2.9000 2.9000 2.9000
3.0000 3.0000 3.0000 3.0000 3.0000
3.1000 3.1000 3.1000 3.1000 3.1000
3.2000 3.2000 3.2000 3.2000 3.2000
3.3000 3.3000 3.3000 3.3000 3.3000
3.4000 3.4000 3.4000 3.4000 3.4000
3.5000 3.5000 3.5000 3.5000 3.5000
3.6000 3.6000 3.6000 3.6000 3.6000
3.7000 3.7000 3.7000 3.7000 3.7000
3.8000 3.8000 3.8000 3.8000 3.8000
3.9000 3.9000 3.9000 3.9000 3.9000
4.0000 4.0000 4.0000 4.0000 4.0000
Columns 6 through 10
2.0000 2.0000 2.0000 2.0000 2.0000
2.1000 2.1000 2.1000 2.1000 2.1000
2.2000 2.2000 2.2000 2.2000 2.2000
2.3000 2.3000 2.3000 2.3000 2.3000
2.4000 2.4000 2.4000 2.4000 2.4000
2.5000 2.5000 2.5000 2.5000 2.5000
2.6000 2.6000 2.6000 2.6000 2.6000
2.7000 2.7000 2.7000 2.7000 2.7000
2.8000 2.8000 2.8000 2.8000 2.8000
2.9000 2.9000 2.9000 2.9000 2.9000
3.0000 3.0000 3.0000 3.0000 3.0000
3.1000 3.1000 3.1000 3.1000 3.1000
3.2000 3.2000 3.2000 3.2000 3.2000
3.3000 3.3000 3.3000 3.3000 3.3000
3.4000 3.4000 3.4000 3.4000 3.4000
3.5000 3.5000 3.5000 3.5000 3.5000
3.6000 3.6000 3.6000 3.6000 3.6000
3.7000 3.7000 3.7000 3.7000 3.7000
3.8000 3.8000 3.8000 3.8000 3.8000
3.9000 3.9000 3.9000 3.9000 3.9000
4.0000 4.0000 4.0000 4.0000 4.0000
Column 11
2.0000
2.1000
2.2000
2.3000
2.4000
2.5000
2.6000
2.7000
2.8000
2.9000
3.0000
3.1000
3.2000
3.3000
3.4000
3.5000
3.6000
3.7000
3.8000
3.9000
4.0000
i=3;
j=6;
Z(i,j)
ans =
2.6620
Z
Z =
Columns 1 through 5
0 0.0800 0.3200 0.7200 1.2800
0 0.0926 0.3704 0.8335 1.4818
0 0.1065 0.4259 0.9583 1.7037
0 0.1217 0.4867 1.0950 1.9467
0 0.1382 0.5530 1.2442 2.2118
0 0.1563 0.6250 1.4062 2.5000
0 0.1758 0.7030 1.5818 2.8122
0 0.1968 0.7873 1.7715 3.1493
0 0.2195 0.8781 1.9757 3.5123
0 0.2439 0.9756 2.1950 3.9022
0 0.2700 1.0800 2.4300 4.3200
0 0.2979 1.1916 2.6812 4.7666
0 0.3277 1.3107 2.9491 5.2429
0 0.3594 1.4375 3.2343 5.7499
0 0.3930 1.5722 3.5374 6.2886
0 0.4288 1.7150 3.8587 6.8600
0 0.4666 1.8662 4.1990 7.4650
0 0.5065 2.0261 4.5588 8.1045
0 0.5487 2.1949 4.9385 8.7795
0 0.5932 2.3728 5.3387 9.4910
0 0.6400 2.5600 5.7600 10.2400
Columns 6 through 10
2.0000 2.8800 3.9200 5.1200 6.4800
2.3153 3.3340 4.5379 5.9270 7.5014
2.6620 3.8333 5.2175 6.8147 8.6249
3.0417 4.3801 5.9618 7.7869 9.8553
3.4560 4.9766 6.7738 8.8474 11.1974
3.9062 5.6250 7.6562 10.0000 12.6562
4.3940 6.3274 8.6122 11.2486 14.2366
4.9208 7.0859 9.6447 12.5971 15.9432
5.4880 7.9027 10.7565 14.0493 17.7811
6.0972 8.7800 11.9506 15.6090 19.7551
6.7500 9.7200 13.2300 17.2800 21.8700
7.4478 10.7248 14.5976 19.0662 24.1307
8.1920 11.7965 16.0563 20.9715 26.5421
8.9842 12.9373 17.6091 22.9997 29.1090
9.8260 14.1494 19.2590 25.1546 31.8362
10.7188 15.4350 21.0087 27.4400 34.7288
11.6640 16.7962 22.8614 29.8598 37.7914
12.6633 18.2351 24.8200 32.4179 41.0289
13.7180 19.7539 26.8873 35.1181 44.4463
14.8297 21.3548 29.0663 37.9642 48.0484
16.0000 23.0400 31.3600 40.9600 51.8400
Column 11
8.0000
9.2610
10.6480
12.1670
13.8240
15.6250
17.5760
19.6830
21.9520
24.3890
27.0000
29.7910
32.7680
35.9370
39.3040
42.8750
46.6560
50.6530
54.8720
59.3190
64.0000
Z(i,j)
ans =
2.6620
f(x(i),y(j))
ans =
0.6250
f(x(j),y(i))
ans =
2.6620
[X,Y] = ndgrid(x,y);
Z = f(X,Y);
Z(i,j)
ans =
0.6250
f(x(i),y(j))
ans =
0.6250
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
surfaces
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
surfaces
x=[1,2,3,4]
x =
1 2 3 4
x=[1,x]
x =
1 1 2 3 4
x1(1)=3*x(1)/4+x(2)/4
x1 =
1
x1(2)=1*x(1)/4+3*x(2)/4
x1 =
1 1
x1(3)=3*x(2)/4+1*x(3)/4
x1 =
1.0000 1.0000 1.2500
x1(4)=1*x(2)/4+3*x(3)/4
x1 =
1.0000 1.0000 1.2500 1.7500
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
surfaces
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
surfaces
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
surfaces
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
surfaces
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
surfaces
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
surfaces
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
surfaces
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
surfaces
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
surfaces
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
surfaces2
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
surfaces2
??? Attempted to access d(2,13); index out of bounds
because size(d)=[13,12].
Error in ==> surfaces2 at 53
d1(2*mm1-3,2*mm2-3)=(1/16)*d(mm1,mm2)+(3/16)*d(mm1,mm2-1)+...
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
surfaces2
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
surfaces2
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
surfaces2
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
surfaces2
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
surfaces3
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
surfaces3
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
surfaces3
diary off