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

조회 수: 1 (최근 30일)
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

답변 (1개)

Jyotsna Talluri
Jyotsna Talluri 2019년 11월 5일
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.

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by