How to perform this for loop for multiple parameter values
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have the following script and vector of temperatures. I need to run it for parameter values of s=0:1:999, mu=0.1:0.1:100, om=0.01:0.01:10, i.e I need to run the script so many times such that all combinations of the parameters are used. I should end up with 1000^3 nll values stored in an array or table.
If anyone could offer some advice on how to approach this, it would be much appreciated.
% T is temperatures, t = time in days
load("Temperature.mat")
T = T'; % from column vector to row vector
AT = T-min(T); % this is the adjusted positive temperatures
s = 0; % lag in days
mu = 0.1;
om = 0.01; % omega
for t=s+1:length(AT)
k = abs(s:-1:(s-t+1));
id=[(t-1):-1:0]+1;
lambda(t) = mu+sum(om.^k.*AT(id))/sum(om.^k);
end
for j=1:length(lambda)
nll = -sum(j*log(lambda(j)))+sum(lambda(j));
end
4 Kommentare
Are Mjaavatten
am 8 Jul. 2021
In line 16, you throw away all results except the last. Should it rather be
nll(j) = -sum(j*log(lambda(j)))+sum(lambda(j));
I think you need to rethink what you want and if you are on the right track. I recommend to start with just one year of data so things are quicker and easier to inspect.
Try to compare results for, say, s = 0 and s = 30 or 180. What do you want to use in your final plot? You surely do not want to plot 12054 x 1000 x 1000 x 1000 data points?
Antworten (0)
Siehe auch
Kategorien
Mehr zu Vehicle Scenarios finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!