Use newer detrend version in old Matlab?

조회 수: 3 (최근 30일)
Manuel Steinbrecher
Manuel Steinbrecher 2017년 6월 1일
답변: Star Strider 2017년 6월 1일
Hey all,
In my current code I am using the detrend function during plotting, to get rid of linear trends in the data. Yet, I only want to subtract the slope, not the mean value. I have seen, that in new Matlab versions there is a function like getTrend or [data_d,T] = detrend(data,Type), which allows to easily get access to the mean value and slope of the detrended data. However, I am using Matlab2012b, and changing this is not an option, so please do not suggest it, it will not happen. But my question would be if it is possible to use the newer code of this function in an older version? I am at a university, and we have the licenses for newer versions as well, but since I cannot find a possibility to download such functions separately, I was wondering if you could help. If that's not possible, I can ofc just use a different approach than detrend, but it would be very neat.
Thx for you help, Manuel
  댓글 수: 2
Adam
Adam 2017년 6월 1일
You can only get builtin functions with the version of the software they are included in. They are part of the version upgrade. If you have a license for the newer versions of the software then I don't know why upgrading the whole software isn't an option, but if it isn't then it isn't.
Manuel Steinbrecher
Manuel Steinbrecher 2017년 6월 1일
Okay, thanks, I already thought so.
Any ideas what then the best way is to subtract just a slope? Basically, using detrend(data) and then adding mean(data) should work, shouldn't it? Or is it calculating the mean value differently?

댓글을 달려면 로그인하십시오.

답변 (1개)

Star Strider
Star Strider 2017년 6월 1일
I would (1) subtract the mean value of the vector from the vector and save it in a separate variable, (2) subtract the trend, (3) add back the mean value.

카테고리

Help CenterFile Exchange에서 Downloads에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by