Azzera filtri
Azzera filtri

Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.

2 visualizzazioni (ultimi 30 giorni)
syms X;
n = length(a) ;
for i=1:n
Tdet1(i) = sqrt(2*a(i)/D(i)*h(i));
FZ(i) = 1-((Tdet1(i).*((cn.*Y(i))+h(i)))./(B(i))); %((cn.*Y(i).+h(i)).*(Tdet(i)./B(i))) ; % Acumulado
alfa(i) = 1-FZ(i) ; % Nivel de Servicio con Tdet
Z(i) = (norminv(1-alfa(i)/2)) ;
fz(i) = normpdf(Z(i)) ; %%abs(0.5-alfa(i)) ; % Función de densidad normal con Z(Tdet)
Tdet(i) = solve ((-a(i)/X^2)+((D*h(i))/2)+ ...
((Z(i)*sg(i))/(2*sqrt(X+L(i))))+ ...
(sg(i)*fz(i))*((((-B(i))*X^2)- ...
(2*X*B(i)*L(i)))/((2*X^3)*sqrt(X+L(i))))- ...
((sg(i)*Z(i))*(((2*L(i)-X)*(((X)*(cn(i)))*Y(i))+ ...
((X)*h(i))))/(2*sqrt(X+L(i))))+((((cn(i))*Y(i))*sqrt(X+L(i)))/X))== 0,X;

Risposte (1)

Bhavana Ravirala
Bhavana Ravirala il 15 Feb 2022
Hi Yineth,
From my understanding, at every iteration the code produces more than one solution for X. So, storing the output in a cell array will eliminate this error.
Tdet{i} = solve ((-a(i)/X^2)+((D*h(i))/2)+ ...
((Z(i)*sg(i))/(2*sqrt(X+L(i))))+ ...
(sg(i)*fz(i))*((((-B(i))*X^2)- ...
(2*X*B(i)*L(i)))/((2*X^3)*sqrt(X+L(i))))- ...
((sg(i)*Z(i))*(((2*L(i)-X)*(((X)*(cn(i)))*Y(i))+ ...
((X)*h(i))))/(2*sqrt(X+L(i))))+((((cn(i))*Y(i))*sqrt(X+L(i)))/X))== 0,X;
Hope this helps.

Categorie

Scopri di più su Get Started with MATLAB in Help Center e File Exchange

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by