1 |
gridname=input('Enter the name of grid: ','s'); |
---|
2 |
[in,x,y,z,bnd]=loadgrid(gridname); |
---|
3 |
newfile='y'; |
---|
4 |
while newfile == 'y', |
---|
5 |
% |
---|
6 |
% Load data from .v2c file |
---|
7 |
% |
---|
8 |
ls *.v2c |
---|
9 |
filename=input('Enter the name of .v2c file: ','s'); |
---|
10 |
[v2c,freq]=read_v2c(filename); |
---|
11 |
% |
---|
12 |
% Determine tidal ellipse parameters |
---|
13 |
% |
---|
14 |
per=2.0*pi/freq/3600.0; |
---|
15 |
[umaj,umin,orien,phase]=tellipse_cen(x,y,v2c(:,2),v2c(:,3),v2c(:,4),v2c(:,5),per); |
---|
16 |
% |
---|
17 |
% Determine vector field which represents the major axis |
---|
18 |
% |
---|
19 |
u=umaj.*cos(pi/2.0-orien); |
---|
20 |
v=umaj.*sin(pi/2.0-orien); |
---|
21 |
% |
---|
22 |
% Plot boundary |
---|
23 |
% |
---|
24 |
figure |
---|
25 |
whitebg('w') |
---|
26 |
hold on |
---|
27 |
bndo=plotbnd(x,y,bnd); |
---|
28 |
set(bndo,'Color','k') |
---|
29 |
axis([min(x) max(x) min(y) max(y)]) |
---|
30 |
set(gca,'Box','on'); |
---|
31 |
set(gca,'XTick',[]); |
---|
32 |
set(gca,'YTick',[]); |
---|
33 |
axis('square') |
---|
34 |
cval=[50 100 200]; |
---|
35 |
hc=lcontour2(in,x,y,z,cval); |
---|
36 |
set(hc,'Color','k') |
---|
37 |
% |
---|
38 |
% Plot vector field |
---|
39 |
% |
---|
40 |
newscale='y'; |
---|
41 |
while newscale == 'y', |
---|
42 |
title([verbatim(filename)]) |
---|
43 |
vmax=max(abs(u+sqrt(-1.0)*v)) |
---|
44 |
scale=input('Enter the desired vector scale: '); |
---|
45 |
hv=vecplot2(x,y,u,v,scale,'m/s',max(x)-0.1*(max(x)-min(x)),min(y)+0.9*(max(y)-min(y))) |
---|
46 |
set(hv,'Color','k') |
---|
47 |
axis([min(x) max(x) min(y) max(y)]) |
---|
48 |
zoom on |
---|
49 |
newscale=input('New scale? (y/n): ','s'); |
---|
50 |
if newscale == 'y', |
---|
51 |
delete(hv); |
---|
52 |
end |
---|
53 |
end |
---|
54 |
% |
---|
55 |
% New .v2c file? |
---|
56 |
% |
---|
57 |
newfile=input('New file? (y/n): ','s'); |
---|
58 |
end |
---|