too many output arguments

156 visualizaciones (últimos 30 días)
Matthew Fernez
Matthew Fernez el 27 de Abr. de 2017
Respondida: Sindhuja Parimalarangan el 1 de Mayo de 2017
q=1;
Cbi=0;
V=60;
C1=5*10^3;
C2=1*10^6;
E1=1*10^4;
E2=1.5*10^4;
dh=-5000;
p=1;
Cp=1000;
Ca=x(1);
Cb=x(2);
T=x(3);
k1=C1*exp^(-E1/(R*T));
k2=C2*exp^(-E2/(R*T));
f(1)=(q/V)*(Cai-Ca)-k1*Ca+k2*Cb;
f(2)=(q/V)*(Cbi-Cb)+k1*Ca-k2*Cb;
f(3)=(q/V)*(Ti-T)+(dh/(p*Cp))*(k1*Ca-k2*Cb);
I have Cai and Ti defined in my workspace. When I run fsolve on this function it comes up as too many output arguments. any ideas??
  2 comentarios
Star Strider
Star Strider el 27 de Abr. de 2017
‘When I run fsolve on this function it comes up as too many output arguments. any ideas??’
Yes!
Since the problem seems to be with your function and your call to fsolve, posting your complete function and your fsolve call will be necessary to understand it.
KSSV
KSSV el 28 de Abr. de 2017
It says, you are trying to extract more number of outputs which fsolve gives. We cannot help you unless complete code is shown.

Iniciar sesión para comentar.

Respuestas (1)

Sindhuja Parimalarangan
Sindhuja Parimalarangan el 1 de Mayo de 2017
A function you are trying to call expects fewer input/output arguments than you have provided it
Here are some possible causes:
1) You have tried to obtain two or more outputs from a function that only returns one.
2) You have multiple functions with the same name. One possible way when this can happen is when you create a function with the same name as an in-built MATLAB function. To identify which function is being called by MATLAB, use the WHICH command as follows:
which -all <function-name>
3) You edited your function and increased the number of input arguments but didn't click save on the editor for that function , then while trying to call this function from your main function, you are getting this error.
Debugging steps :
1) Stop MATLAB on the line where the error occurs. Verify that you have specified the correct number of input and/or output arguments
2) Another way to debug this problem is to use the NARGIN and NARGOUT functions. When you call NARGIN or NARGOUT inside a function, it returns how many inputs or outputs are actually specified in the call to the function.
3) Finally, using the DBTYPE function in the following syntax
dbtype 'FunctionName' 1
This will display the first line of the MATLAB function file, which can be useful for viewing the input and output arguments that the function expects.

Categorías

Más información sobre Argument Definitions en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by