From 66f368947bcbc2ff8104d382dab78229ca35de13 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 23 Sep 2014 16:48:45 +0200 Subject: auch reflektierten Puls anhand von Trajektorie rekonstruieren ... bisher unvollständig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bild.pdf | Bin 74662 -> 39941 bytes ROM.lpr | 33 +++++++++++++-------- ROM.lps | 96 +++++++++++++++++++++++++++++++----------------------------- make.gnu | 3 +- romunit.pas | 43 ++++++++++++++++++++++++++- 5 files changed, 114 insertions(+), 61 deletions(-) diff --git a/Bild.pdf b/Bild.pdf index 52cdcb7..ae01189 100644 Binary files a/Bild.pdf and b/Bild.pdf differ diff --git a/ROM.lpr b/ROM.lpr index 5863de0..26aebb3 100644 --- a/ROM.lpr +++ b/ROM.lpr @@ -12,17 +12,17 @@ uses { you can add units after this }, SysUtils,ROMunit, mathunit, Math; -var inPuls,refPuls,surTraj: tExtPointArray; - i,smooth: longint; - tmax,wmax,absShift: extended; - force,fourier: boolean; +var inPulsO,inPuls,refPuls,surTraj,cRefPuls: tExtPointArray; + i,smooth: longint; + tmax,wmax,absShift: extended; + force,fourier: boolean; -const Verwendung='Verwendung: ROM ($Einfallspuls_Datei $Ausfallspuls_Datei)/(- $trace-Datei-Prefix) $output_inPuls $output_refPuls $output_Trajektorie '+ +const Verwendung='Verwendung: ROM ($Einfallspuls_Datei $Ausfallspuls_Datei)/(- $trace-Datei-Prefix) $output_inPuls $output_refPuls $output_Trajektorie $output_cRefPuls '+ '[-s/--smooth $n] [-f/--force] [-t/--tmax $t] [-w/--wmax $w] [-F/--FFT] [-d/--dt $dt]'; begin - if paramcount<5 then Fehler(Verwendung); - i:=6; + if paramcount<6 then Fehler(Verwendung); + i:=7; force:=false; smooth:=1; tmax:=-1; @@ -79,23 +79,23 @@ begin Fehler(Verwendung); end; if paramstr(1)='-' then - readRawInputs(paramstr(2),inPuls,refPuls,absShift) + readRawInputs(paramstr(2),inPulsO,refPuls,absShift) else begin - readTextInput(paramstr(1),inPuls); + readTextInput(paramstr(1),inPulsO); readTextInput(paramstr(2),refPuls); end; write(stderr,'Input sortieren ...'); - sort(inPuls); + sort(inPulsO); sort(refPuls); writeln(stderr,' fertig'); - uniq(inPuls,false); + uniq(inPulsO,false); uniq(refPuls,false); write(stderr,'Input interpolieren ...'); - interpoliere(inPuls); + interpoliere(inPulsO); interpoliere(refPuls); writeln(stderr,' fertig'); flip(refPuls); - integrate(inPuls); + integrate(inPulsO,inPuls); integrate(refPuls); removeLinearOffset(inPuls); removeLinearOffset(refPuls); @@ -142,9 +142,16 @@ begin normiere(refPuls); normiere(surTraj); writeln(stderr,' fertig'); + end + else begin + write(stderr,'Reflektierten Puls berechnen ...'); + berechneRefPuls(inPulsO,surTraj,cRefPuls); + integrate(cRefPuls); + writeln(stderr,' fertig'); end; if paramstr(3)<>'-' then writeOutput(paramstr(3),inPuls); if paramstr(4)<>'-' then writeOutput(paramstr(4),refPuls); if paramstr(5)<>'-' then writeOutput(paramstr(5),surTraj); + if (paramstr(6)<>'-') and not fourier then writeOutput(paramstr(6),cRefPuls); end. diff --git a/ROM.lps b/ROM.lps index b6e2d2d..99565a0 100644 --- a/ROM.lps +++ b/ROM.lps @@ -8,24 +8,24 @@ - - - - + + + + - - - - + + + + @@ -34,132 +34,136 @@ - + - + - + - - + + - - + + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - + - + - - + + - + - + - + - + - + - + - + - + + + + + diff --git a/make.gnu b/make.gnu index 9a85259..f3736e2 100644 --- a/make.gnu +++ b/make.gnu @@ -22,5 +22,6 @@ else { # set ytics 10**-2 out plot "~/Dokumente/Prograemmchen/ROM/surface.dat" using 1:2 with lines lt 1 title "surface", \ "~/Dokumente/Prograemmchen/ROM/input.dat" using 1:2 with lines lt 2 title "input", \ - "~/Dokumente/Prograemmchen/ROM/output.dat" using 1:2 with lines lt 3 title "output" + "~/Dokumente/Prograemmchen/ROM/output.dat" using 1:2 with lines lt 3 title "output", \ + "~/Dokumente/Prograemmchen/ROM/outputC.dat" using 1:2 with lines lt 4 title "output reconstructed" diff --git a/romunit.pas b/romunit.pas index aaab446..9437006 100644 --- a/romunit.pas +++ b/romunit.pas @@ -20,7 +20,8 @@ function findeExtrema(const dat: tExtPointArray; maxima: boolean): tLongintArra procedure filtereExtrema(const dat: tExtPointArray; var extrema: tLongintArray; sollAbst, toleranz: extended); procedure monotonieHerstellen(const dat: tExtPointArray; var minima,maxima: tLongintArray); procedure gesamtverschiebung(var inPuls,outPuls: tExtPointArray; var absShift: extended); -procedure integrate(var dat: tExtPointArray); +procedure integrate(var dat: tExtPointArray); overload; +procedure integrate(indat: tExtPointArray; out outdat: tExtPointArray); overload; procedure removeLinearOffset(var dat: tExtPointArray); procedure flip(var dat: tExtPointArray); procedure vereineExtrema(const dat1,dat2: tExtPointArray; var el1,el2: tLongintArray; toleranz: extended); @@ -28,6 +29,7 @@ procedure uniq(var dat: tExtPointArray; streng: boolean); procedure fft(var dat: tExtPointArray); procedure interpoliere(var dat: tExtPointArray); procedure normiere(var dat: tExtPointArray); +procedure berechneRefPuls(inPuls,surTraj: tExtPointArray; out cRefPuls: tExtPointArray); type tSortThread = class(tThread) @@ -715,6 +717,17 @@ begin dat[i].y:=dat[i].y * (dat[i].x-dat[i-1].x)+dat[i-1].y; end; +procedure integrate(indat: tExtPointArray; out outdat: tExtPointArray); +var i: longint; +begin + setlength(outdat,length(indat)); + outdat[0]:=indat[0]; + for i:=1 to length(indat)-1 do begin + outdat[i].x:=indat[i].x; + outdat[i].y:=indat[i].y * (indat[i].x-indat[i-1].x)+outdat[i-1].y; + end; +end; + procedure removeLinearOffset(var dat: tExtPointArray); var i: longint; dx,dy: extended; @@ -971,6 +984,34 @@ begin dat[i].y:=dat[i].y/m; end; +procedure berechneRefPuls(inPuls,surTraj: tExtPointArray; out cRefPuls: tExtPointArray); +var i,anz: longint; + beta: extended; +const step=107; +begin + i:=0; + setlength(cRefPuls,0); + anz:=0; + while (isurTraj[i].x-surTraj[i].y) do + inc(i); + if i>=length(surTraj)-step then break; + + if anz>=length(cRefPuls) then + setlength(cRefPuls,anz+32768); + beta:=max((surTraj[i+step].y-surTraj[i].y)/(surTraj[i+step].x-surTraj[i].x),-0.5); + cRefPuls[anz].x:=surTraj[i].x+surTraj[i].y; + cRefPuls[anz].y:= + (inPuls[anz].y * (inPuls[anz+step].x - surTraj[i].x+surTraj[i].y) + + inPuls[anz+step].y * (- inPuls[anz].x + surTraj[i].x-surTraj[i].y)) / + (inPuls[anz+step].x - inPuls[anz].x) * + (1-beta)/(1+beta); + inc(anz); + inc(i); + end; + setlength(cRefPuls,anz); +end; + // tSortThread ***************************************************************** constructor tSortThread.create(pd: pTExtPointArray; sta, sto: longint); -- cgit v1.2.3-70-g09d2