When The following error occurred converting from sym to double: Unable to convert expression into double array

4 views (last 30 days)
When I run my code, I keep getting this error: "The following error occurred converting from sym to double: Unable to convert expression into double array."
syms landa;
rho=[4 6 8 2 2 8 6]';
h=[5 8 5 7 8 2]';
T(7)=rho(7);
for i=6:-1:1
T(i)=rho(i)*(T(i+1)+rho(i)*tanh(landa*h(i)))./...
(rho(i)+T(i+1)*tanh(landa*h(i)));
end

Answers (1)

madhan ravi
madhan ravi on 26 Apr 2019
Edited: madhan ravi on 26 Apr 2019
T=sym(zeros(size(rho))); % before the line T(7)...

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!