LCF_solve_QP: Linear combination fitting solve function

Description Usage Arguments Examples

Description

Quadratic programming solution function for linear combination fitting (LCF)

Usage

1
LCF_solve_QP(LCF.stds, LCF.samp)

Arguments

LCF.stds

Standards for LCF

LCF.samp

Sample for LCF

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
data(stdmix)
corr.spec.standards  <- initial_load(specdat[1:4], 
  corr.norm = c(-36, -15, 37, 58))
corr.spec.samples    <- initial_load(specdat[5:8], 
  corr.norm = c(-36, -15, 37, 58))
fit.standards <- std_df(sample = corr.spec.samples[[1]], 
  all.standards = corr.spec.standards)
corr.spec <- bkg_corr(raw.spec = corr.spec.samples[[1]], 
  corr.norm = c(-36, -15, 37, 58))
## set fitting range parameters relative to E zero
E.zero <- corr.spec.samples[[1]]$data$E0
LC.pre <- -14
LC.post <- 46
## find ranges that have to be fitted
abs.pre <- abs(corr.spec[["energy"]]-(E.zero+LC.pre))
abs.post <- abs(corr.spec[["energy"]]-(E.zero+LC.post))
range.pre <- which(abs.pre == min(abs.pre))
range.post <- which(abs.post == min(abs.post))
## extract standards and sample in given range
LC.sample <- corr.spec["cor.absorption"][range.pre:range.post,]
LC.standards <- fit.standards[range.pre:range.post,]
## actual fitting
fit.result <- LCF_solve_QP(LCF.stds = LC.standards, LCF.samp = LC.sample)
print(fit.result)

Example output

      AlPO4     FePO4     HydAp        IHP        R.fac
1 0.2319872 0.3776037 0.3534028 0.03700625 0.0001531837

LCF documentation built on May 2, 2019, 6:08 a.m.

Related to LCF_solve_QP in LCF...