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

 Respuesta aceptada

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 comentarios

Daniel Fiedorek
Daniel Fiedorek el 16 de Jul. de 2021
Thank You!
Star Strider
Star Strider el 16 de Jul. de 2021
As always, my pleasure!
.

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Versión

R2014a

Etiquetas

Preguntada:

el 15 de Jul. de 2021

Comentada:

el 16 de Jul. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by