Last change
on this file since 772 was
434,
checked in by sommeria, 13 years ago
|
corrections in the use of get_field
test_tps introduced, to test thin plate shell functions
tps-eval_dxy corrected (bug on the calculation of the derivatives fixed)
|
File size:
933 bytes
|
Line | |
---|
1 | x=2*pi*rand(100,1);%set of random x coordinates from 0 to 2pi |
---|
2 | y=2*pi*rand(100,1);%set of random y coordinates |
---|
3 | %U=exp(-(x-pi).*(x-pi)-(y-pi).*(y-pi));% gaussian |
---|
4 | U=x; |
---|
5 | [U_smooth,U_tps]=tps_coeff([x y],U,0);%calculate tps coeff |
---|
6 | xI=0:0.1:2*pi;%interpolation grid |
---|
7 | yI=0:0.1:2*pi; |
---|
8 | [XI,YI]=meshgrid(xI,yI); |
---|
9 | [npy,npx]=size(XI); |
---|
10 | XI=reshape(XI,[],1); |
---|
11 | YI=reshape(YI,[],1); |
---|
12 | EM = tps_eval([XI YI],[x y]);%evaluate interpolation on the new grid |
---|
13 | U_eval=EM*U_tps; |
---|
14 | U_eval=reshape(U_eval,npy,npx); |
---|
15 | figure(1) |
---|
16 | imagesc(U_eval,[-1 1]) |
---|
17 | [DMX,DMY] = tps_eval_dxy([XI YI],[x y]); |
---|
18 | DUX_eval=DMX*U_tps; |
---|
19 | DUY_eval=DMY*U_tps; |
---|
20 | DUX_eval=reshape(DUX_eval,npy,npx); |
---|
21 | % plot(yI,U_eval(:,5)) |
---|
22 | figure(2) |
---|
23 | DUY_eval=reshape(DUY_eval,npy,npx); |
---|
24 | imagesc(DUX_eval,[-1 1]) |
---|
25 | % plot(xI,DU_eval(:,5)) |
---|
26 | figure(3) |
---|
27 | imagesc(DUY_eval,[-1 1]) |
---|
28 | figure(4) |
---|
29 | % plot(x,U_eval(50,:),x,DUX_eval(50,:),x,DUY_eval(50,:)) |
---|
30 | size(U_eval(50,:)) |
---|
31 | size(xI) |
---|
32 | plot(xI,U_eval(50,:),xI,DUX_eval(50,:),xI,DUY_eval(50,:)) |
---|
Note: See
TracBrowser
for help on using the repository browser.