Function handle doesn't work as intended

7 views (last 30 days)
Hi, I have a question regarding my matlab-code. Basically, the code should calculate the heat-transfer for drop-wise condensation. At the end of the program, I should have a funvtion with deltaT as variable parameter. But the error-message basically says that .* can't be used with function handles. I attached the file, so if anyone is willing to help me, you would make me very happy :) Any ideas how I could get the program fixed? Thanks in advance and best regards, Karsten
Karsten Gros
Karsten Gros on 15 Jun 2017
Edited: James Tursa on 15 Jun 2017
Hi, thanks for your quick response. Here's the error message:
Undefined operator '.*' for input arguments of type 'function_handle'.
Error in
Error in qi_neu (line 97)

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 15 Jun 2017
Q = @(r, deltaT) pi.*r.^2.*(deltaT-(2.*T_sat.*sigma)./(H_fg.*r.*rho_l)).*((1+cos(Theta)./(2.*h_i)+delta./(lamda_coat.*sin(Theta).^2)+(r.*Theta)./(4.*lamda_l.*sin(Theta)))).^(-1)
needs to be
Q = @(r, deltaT) pi.*r.^2.*(deltaT-(2.*T_sat.*sigma)./(H_fg.*r.*rho_l)).*((1+cos(Theta)./(2.*h_i(deltaT))+delta./(lamda_coat.*sin(Theta).^2)+(r.*Theta)./(4.*lamda_l.*sin(Theta)))).^(-1)
James Tursa
James Tursa on 19 Jun 2017
Not a "major programming language", but MS Excel uses ln() for natural log.

Sign in to comment.

More Answers (2)

James Tursa
James Tursa on 15 Jun 2017
Just quickly looking though what was posted, this line:
grid onq_tot2 = @(deltaT) integral(@(r) stopp(r), r_c, r_max)
looks like it should be two separate lines:
grid on
q_tot2 = @(deltaT) integral(@(r) stopp(r), r_c, r_max)

Karsten Gros
Karsten Gros on 19 Jun 2017
Edited: Karsten Gros on 19 Jun 2017
Hi, your corrections worked ;) Thank you very much. Could you give me a hint where you replaced the r with the r_c? And When I tried to plot the end-equation, It didn't work. Any hints for that one? (It works for q_tot1, but not for q_tot2 or q_tot) Best regards :)
Karsten Gros
Karsten Gros on 28 Jun 2017
It actually works, thank you very much :) I learnt a lot ;)

Sign in to comment.


Find more on Graphics Object Properties 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!