Page 1 of 1

Simple Syntax Question Regarding Baseline Correction

Posted: Tue Aug 24, 2021 8:32 am
by Leo Porter-Zasada

Hi,

I want to perform a baseline correction on my data (a simple broad Cu(II) single peak). I see in the documentation the syntax is:
CorrSpec = basecorr(Spec,Dim,Ord)
[CorrSpec,BLine] = basecorr(Spec,Dim,Ord)

I am a novice at Easyspin/MatLab so figuring out how to use this on my data is giving me some errors as I can't just copy-paste this.

My code is:
clear, clc, clf

[B_G,spc] = eprload('2228B C4 macrocycle 1 molp in Spec KBr lightly ground');
B_mT = B_G/10; % convert field values from Gauss to mT
data = peaks(100)
cdata = basecorr(data,[],[3 3])

plot(B_G,spc);

%%

Nothing is really happening to my data visibly and I get

Warning: Rank deficient, rank = 15, tol = 3.284198e+01.

Thanks!


Re: Simple Syntax Question Regarding Baseline Correction

Posted: Wed Aug 25, 2021 2:08 am
by ykliao

Hello,

Nothing has happened to your data because you didn't apply the basecorr function on your spectrum.

The two lines in your code:

Code: Select all

data = peaks(100)
cdata = basecorr(data,[],[3 3])

are just an example on how to apply the function on a 2D data.

In your case, you should put your spectrum (spc) in the basecorr, and assign the output to some variable as baseline-corrected spectrum. You can do it like this:

Code: Select all

cspc = basecorr(spc,n,p) % n is the dimension where your spectrum is, and p is the order of polynomial for your baseline

I hope this helps.