Line | |
---|
1 | function [RSP,ISP,alp]=SRf(SP,SS)
|
---|
2 | %RECOVERY PART
|
---|
3 | w0=SP(1);
|
---|
4 | %Make LF extrapolation
|
---|
5 | DSP=diff(SS)./diff(SP);
|
---|
6 | rs=sum(DSP(1:3));%must be negative
|
---|
7 | r=SS(1);
|
---|
8 | alp=rs/r/w0-log(r)/(w0*w0);
|
---|
9 | bet=2*log(r)/w0-rs/r;
|
---|
10 | x=0:(w0-1);
|
---|
11 | % syms xx
|
---|
12 | % w0
|
---|
13 | % rs
|
---|
14 | % vpasolve(-2*w0*xx*exp(-xx*w0^2)==rs, xx)
|
---|
15 | % LFpart=exp(alp.*x.*x+bet.*x);
|
---|
16 | LFpart=exp(-abs(log(r)/(w0^2)).*x.^2);
|
---|
17 | LFpart( LFpart>1)= 1;
|
---|
18 | % LFpart=ones(size(x));
|
---|
19 | % LFpart=exp(-1.8262e-05*x.^2);
|
---|
20 | % LFpart=1;
|
---|
21 | %Make interpolation
|
---|
22 | % SS=SS.*exp(-1.8262e-05*w0.^2)
|
---|
23 | ISP = pchip(SP,SS,w0:max(SP));
|
---|
24 | %Make HF extrapolation
|
---|
25 | w=1:(2^12-length(ISP)-length(LFpart));
|
---|
26 | wmax=max(SP);
|
---|
27 | rosh=DSP(end);
|
---|
28 |
|
---|
29 | alp=(rosh/ISP(end))*wmax;
|
---|
30 | c=0;
|
---|
31 | while (alp>0)
|
---|
32 | c=c+1;
|
---|
33 | rosh= (SS(end)-SS(end-c))/(SP(end)-SP(end-c));
|
---|
34 | alp=(rosh/ISP(end))*wmax;
|
---|
35 | end
|
---|
36 | if (alp>-2) alp=-2;end
|
---|
37 | HFpart=ISP(end)* (1+w/wmax).^(alp);
|
---|
38 | HFpart(HFpart<eps)=eps;
|
---|
39 |
|
---|
40 | %Connect all together
|
---|
41 | ISP=[LFpart,ISP,HFpart];
|
---|
42 | %Mirror image of the spectrum
|
---|
43 | RSP=[ISP,fliplr(ISP)]; |
---|
Note: See
TracBrowser
for help on using the repository browser.