Merge branch 'fixf'
[wrf-fire-matlab.git] / femwind / plot_error_slice.m
blobdf1ffbf74fba0b9af8eb6d815b2304fbccb1cff9
1 function plot_error_slice(e,r,X,tstring,params)
2 % plot_error_slice(e,r,F,K,X,tstring,params)
3 if params.graphics < 0
4     return
5 end
6 n = size(X{1});
7 nn=prod(n);
8 s=round(0.5+params.slice*n(2)*(1-eps));  % y index of slice
9 xx=squeeze(X{1}(:,s,:));
10 yy=squeeze(X{2}(:,s,:));
11 zz=squeeze(X{3}(:,s,:));
12 t=sprintf('slice %g y=%g %s',s,yy(1),tstring);
13 ff = 'no_error_title';
14 if ~isempty(r),
15     residual=zeros(n);
16     for i=1:nn
17         [s1,s2,s3]=ind2sub(n,i);
18         residual(s1,s2,s3)=r(i);
19     end
20     figure(params.res_slice_fig)
21     mesh(xx,zz,squeeze(residual(:,s,:)));
22     xlabel('horizontal')
23     ylabel('vertical')
24     if isfield(params,ff) && ~getfield(params,ff)
25         title(t)
26     else
27         title(['residual ',t])
28     end
29 end
30 if ~isempty(e)
31     lambda_err=zeros(n);
32     for i=1:nn
33         [s1,s2,s3]=ind2sub(n,i);
34         lambda_err(s1,s2,s3)=e(i);
35     end
36     figure(params.err_slice_fig),clf
37     l=squeeze(lambda_err(:,s,:));
38     mesh(xx,zz,l)
39     xlabel('horizontal')
40     ylabel('vertical')
41     if isfield(params,ff) && ~getfield(params,ff)
42         title(t)
43     else
44         title(['error ',t])
45     end
46     
47 end
48 drawnow