rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
HMM_REKONSTRUKTION.m
1 function [u,x,s]=HMM_REKONSTRUKTION(U,xfront,X,dx,n_x)
2 %
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4 %%% stueckweise konstante Rekonstruktion %%%
5 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6 %
7 % function [u,x,s]=HMM_REKONSTRUKTION(U,xfront,X,dx,n_x)
8 %
9 % Input: U derzeitige makroskopische Loesung
10 % xfront Stelle der Unstetigkeit
11 % X Vektor, makroskopische Gitterpunkte
12 % dx, n_x mikroskopische Ortsschrittweite bzw. Anzahl
13 % mikroskopische Ortsschritte
14 % Output: u stueckweise konstante Rekonstruktion der L?sung
15 % x Vektor, mikroskopische Gitterpunkte
16 % s Gitterpunkt an dem sich die Unstetigkeit befindet
17 
18 
19 
20 x=(xfront:dx:xfront+(n_x-1)*dx);
21 
22 % Berechnung des Intervalls I=(A,B], A,B \in X, so dass xfront \in I
23 a=(X<=xfront);
24 s=find(a==1, 1, 'last' );
25 %A=X(s);
26 %B=X(s+1);
27 
28 % Konstruiere u=RU durch stueckweise konstante Rekonstruktion
29 u=zeros(1,n_x); % initialisieren
30 if (s-1)<=0
31  u(1)=U(1);
32 else
33  u(1)=U(s-1);
34 end
35 for i=2:n_x
36  u(i)=U(s+2);
37 end