Clear Filters
Clear Filters

remove trend in temperature data

2 views (last 30 days)
Sam
Sam on 24 Mar 2020
Commented: Peng Li on 24 Mar 2020
Hello,
In attachment you can find a figure of temperature data over the next 2.2 days. This temperature is the leg temperature of a chicken measured by a leg temperature sensor. During night, the temperature fluctuates approximately around a constant value. When chickens woke up at 9 AM in the morning, there is an immediate temperature drop since they are not sitting on the leg sensor anymore and thus consecutive temperature drop is observed.
After the chicken wakes up, temperature keeps rising throughout the day (until 6 PM when light fall out and chickens go back to sleep). This temperature rise during the day, is caused by the building warming up and also by the heat loss of all the chickens inside this building. I want to detrend my data, so that this temperature rise during day isn't contaminating my data anymore.
I want to analyze my data as if the experiments were done in a environmental control chamber where the ambient temperature has a continuous constant value of 21°C.
So far, I've used the 'detrend' function, but without any good results (it just shifts my data around 0...).
Can anyone help or suggest some other methods I could use?
Thanks
detrendchick = detrend(temp_PW_Chick3);
t = linspace(0,((((length(temp_PW_Chick3)/fs)/60)/60)/24),length(temp_PW_Chick3));
figure(1)
plot(t,temp_PW_Chick3)
hold on
plot(t,detrendchick)
xlabel('Time (days)')
ylabel('Temperature (°C)')

Accepted Answer

Peng Li
Peng Li on 24 Mar 2020
You may try to use wavelet decomposition (wavedec). You can estimate how many layers you may need to proximate the approximation coefficients to the component you need, and asign them to either 0 or the mean. And reconstruct the signal through waverec.
  1 Comment
Peng Li
Peng Li on 24 Mar 2020
Another thought came to my mind when I was cooking this morning. The rise and drop of temperature show clearly a circadian rhythm. Will that 24 hour rhythm be a component that you may want to keep instead of be treated as a "trend" and removed? wavedec may help extract this 24-hour component of course. And the other commonly used way to fit the data with a 24-hour cos/sin signal is so called cosinor fitting. Try to search the literature and you will find a bunch of papers in the chronobiology field.

Sign in to comment.

More Answers (0)

Categories

Find more on Line Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!