Unable to perform assignment because the size of the left side and right side are different
Ältere Kommentare anzeigen
I want to estimate a 3-parameter weibul distribution. And I got the warning "Consider Preallocating for speed",
so I create the lines with the zeros in the middle.
But for "params = zeros(n,length(b_A),length(T_A));" I get the warning "Unable to perform assignment because the size of the left side is 1-by-5 and the size of the right side is 1-by-3."
Can someone help me plz?
Also if you have any ideas for improving my code, I would appreciate that. I am new on matlab.
n= 10;
t0= 0.5;
b_A= 1:5;
T_A= 1:5;
LowerBound= [0 0 0];
rng('shuffle')
data= zeros(n,length(b_A),length(T_A));
params= zeros(n,length(b_A),length(T_A));
for k= 1:length(T_A)
for i= 1:length(b_A)
data(:,i,k) = wblrnd(b_A(i),T_A(k), [n,1]) + t0;
start= [b_A(i) T_A(k) t0];
custompdf = @(x,a,b,c) (x>c).*(b/a).*(((x-c)/a).^(b-1)).*exp(-((x-c)/a).^b);
opt = statset('MaxIter',1e5,'MaxFunEvals',1e5,'FunValCheck','off');
params(i,:,k) = mle(data(:,i,k),'pdf',custompdf,'start',start,'Options',opt,'LowerBound',LowerBound,'UpperBound',[Inf Inf min(data(:,i,k))])
end
end
for k= 1:length(T_A)
for i= 1:length(b_A)
params(i,4,k) = b_A(i);
params(i,5,k) = T_A(k);
params(i,6,k) = t0;
end
end
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Exploration and Visualization finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!