source: anuga_validation/convergence_study/animatesww2d_alt.m @ 7737

Last change on this file since 7737 was 4698, checked in by sexton, 18 years ago

(i) commented matlab script from William (ii) scripts looking at grad data

File size: 1.7 KB
RevLine 
[4693]1function animatesww2d_alt(sww_filename,movie_filename,range)
2
3nc2mat(sww_filename,'swwtemp.mat'); %convert .sww to .mat
4
[4698]5load('swwtemp.mat'); % load the data from the temporary .mat file
[4693]6
[4698]7figure(1); % Create a new figure
[4693]8
9if nargin > 1
[4698]10    % If we're making an animation then set the figure location and prepare
11    % the avi file
[4693]12    figure(1);set(gcf,'Position',[200 400 800 300]);
13    mov=avifile(movie_filename,'FPS',5)
14end
15
[4698]16i=find(V_y==0); % Find all the points which lie along the x-axis
17                % This could be made more general, or done in a way that is
18                % safer against rounding-off errors.
19                %
20                % 'i' becomes a vector containing the indices of those points
21                % which are on the x-axis.
[4693]22
23if nargin < 3
[4698]24    % If we don't specify the range to plot on the axes, then set it
25    % here. X-axis covers the range in V_x, and the y-axis is 1 metre
26    % outside the range of values in V_stage.
[4693]27    range=[min(V_x) max(V_x) min(min(V_stage))-1 max(max(V_stage))+1];
28end
29
[4698]30m=V_stage(1,i); % m is the vector containing the maximum stage values found
31                % so far among the points selected with 'i'.
[4693]32
33for t=1:length(V_time)
34   
[4698]35    m=max(m,V_stage(t,i)); % update the vector of maximum values
36   
[4693]37    plot(V_x(i),V_stage(t,i),V_x(i),V_elevation(i),V_x(i),m,'.');
[4698]38    % Plot the stage of the points that are selected using the vector 'i'
39   
[4693]40    axis(range)
[4698]41    % set the range of the axes
[4693]42
43    title(num2str(V_time(t)));drawnow;
[4698]44    % label with the time
45   
[4693]46    if nargin>1
[4698]47        % If we're making an animation then add a new frame
[4693]48        F=getframe(gcf);
49        mov=addframe(mov,F);   
50    end
51   
52end
53
54if nargin > 1
[4698]55    % Close the animation file if necessary
[4693]56    mov=close(mov);
57end
Note: See TracBrowser for help on using the repository browser.