MATLAB Answers

0

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

Brett Rayfield さんによって質問されました 2019 年 11 月 2 日
最新アクティビティ Jyotsna Talluri さんによって 回答されました 2019 年 11 月 5 日
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

  0 件のコメント

サインイン to comment.

タグ

製品


リリース

R2018b

1 件の回答

回答者: 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.

  0 件のコメント

サインイン to comment.



Translated by