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

 Réponse acceptée

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 commentaires

Daniel Fiedorek
Daniel Fiedorek le 16 Juil 2021
Thank You!
Star Strider
Star Strider le 16 Juil 2021
As always, my pleasure!
.

Connectez-vous pour commenter.

Plus de réponses (0)

Produits

Version

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by