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

1 visualización (últimos 30 días)
I am trying to solve this equation for h2 numerically but I keep getting the above error. Everything in the equation below is a number except for h2
T_inf1 = Tempfree1(1) ;
k1 = 167 ;
L1 = 0.0335788 ;
P1 = 0.1839468 ;
Ac1 = 0.0001333248946 ;
xfree2 = 0.0066294 ;
xfree3 = 0.0168656 ;
xfree4 = 0.031242 ;
for i = 1:length(Tempfree2)
Tb1 = Tempfree1(i) ;
Temp2_1 = Tempfree2(i) ;
syms h2
eqnfree_h2 = (Temp2_1 - T_inf1)/(Tb1 - T_inf1) == (cosh(sqrt(h2*P1/k1/Ac1)*(L1-xfree2))+(h2/sqrt(h2*P1/k1/Ac1)/k1)*sinh(sqrt(h2*P1/k1/Ac1)*(L1-xfree2)))/(cosh(sqrt(h2*P1/k1/Ac1)*L1)+(h2/sqrt(h2*P1/k1/Ac1)/k1)*sinh(sqrt(h2*P1/k1/Ac1)*L1)) ;
h_free_2(i) = vpasolve(eqnfree_h2, h2) ;
end
This is for a lab class and I making calculations based on data from a csv file

Respuestas (1)

Jyotsna Talluri
Jyotsna Talluri el 5 de Nov. de 2019
The error is because of inappropriate indexing.As you do not know the size of the result instead of assigning it to a single variable h_free_2(i)...Assign it to a vector h_free_2(i,:) .
Refer to the below link to know more about indexing.

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by