How do I change the size of xq while using the interp1 function as supervision?
Show older comments
Changing xq size in the interp1 function:
Background
I'm working with persistent phosphors, in my research I'm trying to find out the correlation between the temperature and the amount of traps being released while heating it. So I have a material (Strontiumalumnate SrAl2O4:Eu,Dy) (doped with Europium and Dysprosium) which I bombard with X-rays for an x amount of time, (afterwards I'm letting the material afterglow so the Dysprosium traps will be mostly emptied and the SNR is higher.) this while I cool/heat it at a set temperature. I do this for an y amount of time.
When this is done I heat the material from the set temperature until 225 degrees Celcius with a known β (heating rate), I've chosen it to be 30 K/min so 0,5 K/sec. I'm using a PBS, with a temperature higher the material will melt (I'm measuring this on a Linkam heating stage, so powder is not that practical). The integration time of the spectrometer is 5 seconds, so every five seconds the spectrometer measures a spectrum from 195 until approxiamately 1000 nm. Now I'm interested in the following, the arbitrary intensity as function of temperature and mostly while I'm heating it from the set temperature until 225.
Script status
So I'm firstly determining the x values for the temperatures. Which worked, now I'm trying to interpolate the temperature steps so that the graph can be from -100 degrees Celcius all the way to 225. Which gives me a better insight on which temperature the most traps will be released. Now the error is that these two have different sizes of values while I'm trying to plot the temperature against the interpolation.
Below I have a part of my script which I'm using for this question.
idx = temperature <= 225;
temperature = temperature(idx);
spectra = spectra(:, idx);
controle = zeros(size(spectra,1), length(xq)); % lege matrix voor resultaat
for k = 1:size(spectra,1)
controle(k,:) = interp1(temperature, spectra(k,:), xq, 'spline');
end
Sorry for the mixed Dutch in the script, I'll translate it for easier reading:
controle=checking
lege= empty
voor=for
resultaat= result
I get the following error:
Error using plot
Vectors must be the same length.
Error in TLmin100 (line 34)
plot(temperature, controle);
I'm unsure how to change the size of xq when using the interp1 function. I've tried calculating the amount of steps needed to have the same amount of steps when calculating it without interpolation. This gave the same error.
The sizes of are the following:
size(temperature)
ans =
1 131
size(controle)
ans =
1024 326
I'm curious how I should fix this. Thanks in advance for reading and thinking with me to solve this!
I've added the csv and the matlab script if interested or needed for tips.
Accepted Answer
More Answers (0)
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!