Hi!
Could any one help me with solvin this problem usin "fsolve"? When i run this i get: "Undefined function 'fsolve' for input arguments of type 'function_handle'" The versison of Matlab on my computer is: Mataab R2020b- academic use.
syms x
Tinc = 5+273;
Tinv = 45+273;
mv = 1000;
Cpv = 4180;
A = 0.032*(21-2);
h = 20;
U = 2*h;
Qc=@(x)mv*Cpv(Tinv-x);
Q=@(x)U*A*(x-Tinc);
r=@(x)Q(x)-Qc(x);
Tutc=fsolve(r,30);

 Respuesta aceptada

Matt J
Matt J el 19 de Nov. de 2020
Editada: Matt J el 19 de Nov. de 2020
I don't understand why you would be using Symbolic Math Toolbox variables,
syms x
unless you were planning to use solve,
Tinc = 5+273;
Tinv = 45+273;
mv = 1000;
Cpv = 4180;
A = 0.032*(21-2);
h = 20;
U = 2*h;
Qc=mv*Cpv*(Tinv-x);
Q=U*A*(x-Tinc);
Tutc=solve(Q==Qc)
Tutc = 

3 comentarios

Mohamed Asaad
Mohamed Asaad el 20 de Nov. de 2020
I don't know either why I am doing that, I am just trying to solve this problem by using fsolve. I tried with different ways to do that even without syms x as follows:
Tinc = 5+273;
Tinv = 45+273;
mv = 1000;
Cpv = 4180;
A = 0.032*(21-2);
h = 20;
U = 2*h;
Qc=@(x)mv*Cpv*(Tinv-x);
Q=@(x)U*A*(x-Tinc);
r=@(x)Q(x)-Qc(x);
Tutc=fsolve(r,30)
"Undefined function 'fsolve' for input arguments of type 'function_handle'."
but I did not work either.
Matt J
Matt J el 20 de Nov. de 2020
Presumably, it is because you do not have the Optimization Toolbox. As with Stephan, it works fine when I run it.
Mohamed Asaad
Mohamed Asaad el 21 de Nov. de 2020
Ok thanks for your reply!

Iniciar sesión para comentar.

Más respuestas (1)

Stephan
Stephan el 19 de Nov. de 2020

2 votos

Tinc = 5+273;
Tinv = 45+273;
mv = 1000;
Cpv = 4180;
A = 0.032*(21-2);
h = 20;
U = 2*h;
Qc=@(x)mv*Cpv*(Tinv-x);
Q=@(x)U*A*(x-Tinc);
r=@(x)Q(x)-Qc(x);
Tutc=fsolve(r,30)

3 comentarios

Mohamed Asaad
Mohamed Asaad el 20 de Nov. de 2020
It does not work for me, I get "Undefined function 'fsolve' for input arguments of type 'function_handle'."
Stephan
Stephan el 20 de Nov. de 2020
Editada: Stephan el 20 de Nov. de 2020
In R2020a it works for me:
Equation solved, solver stalled.
fsolve stopped because the relative size of the current step is less than the
value of the step size tolerance squared and the vector of function values
is near zero as measured by the value of the function tolerance.
<stopping criteria details>
Tutc =
317.9998
Mohamed Asaad
Mohamed Asaad el 21 de Nov. de 2020
Ok thanks for your reply!

Iniciar sesión para comentar.

Productos

Versión

R2020b

Etiquetas

Preguntada:

el 19 de Nov. de 2020

Comentada:

el 21 de Nov. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by