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

4 ビュー (過去 30 日間)
Lucia Navarro 2022 年 5 月 14 日

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 件のコメント表示非表示 なし
Torsten 2022 年 5 月 14 日
The maximum number of arguments for "int" is 4. Your outer "int" always has 5.

サインインしてコメントする。

### 回答 (1 件)

John D'Errico 2022 年 5 月 14 日

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.
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.

サインインしてコメントする。

R2022a

### Community Treasure Hunt

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

Start Hunting!

Translated by