I am attempting to use matlab to model a dataset given in 2 columns, temperature and distance, where every 193 rows corresponds to 1 time interval
(i.e. the first column is distance and second is temp with the first 193 rows being t1, the next 193 rows being t2, and so on).
I need to model it such that I have a function of temperature in the form T(d,t). I am struggling on figuring out how to extract the time information from the dataset in order to create a fit. Any help is appreciated

 채택된 답변

Star Strider
Star Strider 2021년 7월 15일

0 개 추천

If you know what the times are, create a time vector of them using the repmat function (or repelem function, introduced in R2015a). For example, if the times go from 0 to 5, and there are 4 of them (rather than 193), creating the time vector would go somthing like this:
time = 1:5;
repeats = 4;
tv1 = reshape(repmat(time, repeats, 1), [], 1)
tv1 = 20×1
1 1 1 1 2 2 2 2 3 3
tv2 = repelem(time, repeats).'
tv2 = 20×1
1 1 1 1 2 2 2 2 3 3
You can then use that as the time vector in your linear or nonlinear regression.
.

댓글 수: 2

Daniel Fiedorek
Daniel Fiedorek 2021년 7월 16일
Thank You!
Star Strider
Star Strider 2021년 7월 16일
As always, my pleasure!
.

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

추가 답변 (0개)

제품

릴리스

R2014a

질문:

2021년 7월 15일

댓글:

2021년 7월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by