Why I'm getting error (too many arguments) in my integral

2 views (last 30 days)
I'm trying to do a double integral with comand int but it appears an error to me that says too many arguments. What's wrong in my code?
%Hallando el flujo electrico parte delantera
Intdoble1=int(int(2*y^2+z,x,0,1),4*y,y,0,1);
%Hallando el flujo electrico parte trasera
Intdoble2=int(int(2*y^2+z,x,0,1),y,0,1);
%Hallando el flujo electrico parte derecha
Intdoble3=int(int(2+z,x,0,1),y,0,1);
%Hallando el flujo electrico parte izquierda
Intdoble4=int(int(0,x,0,1),y,0,1);
%Hallando el flujo electrico parte superior
Intdoble5=int(int(2*y^2+1,x,0,1),4*x*y,y,0,1);
%Hallando el flujo electrico parte inferior
Intdoble6=int(int(2*y^2,x,0,1)4*x*y,y,0,1));
FE=Intdoble1+Intdoble2+Intdoble3+Intdoble4+Intdoble5+Intdoble6;
  1 Comment
Torsten
Torsten on 14 May 2022
Edited: Torsten on 14 May 2022
The maximum number of arguments for "int" is 4. Your outer "int" always has 5.

Sign in to comment.

Answers (1)

John D'Errico
John D'Errico on 14 May 2022
Edited: John D'Errico on 14 May 2022
You need to pay MUCH more attention to your code.
For example, just a quick look shows this:
Intdoble6=int(int(2*y^2,x,0,1)4*x*y,y,0,1));
Look inside:
int(2*y^2,x,0,1)
That is the inner call to int. It is fine. But then what do you do? We see:
int(2*y^2,x,0,1)4*x*y
What is that spare 4*x*y? If you wanted to multiply by that expression, you need a * operator. So that line has invalid syntax.
How about this one?
Intdoble1=int(int(2*y^2+z,x,0,1),4*y,y,0,1);
In there, we see the outer call to int has 5 (FIVE) arguments. But int requires 4 arguments. So what is that spare 4*y doing in there?
In fact, in every case, the outer call to int has 5 input arguments.
Now go back and carefully read the error message. Did it say, TOO MANY ARGUMENTS? Look at your code. Read the error messages. They are there to guide you, not to just take up space.

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!