Check for missing argument or incorrect argument data type in call to function 'int'.

I want to write code for this integral function but there is an error
Check for incorrect argument data type or missing argument in call to function 'int'.
Error in nntraining3 (line 12)
P = int(f, x, 0, inf);
How can I improve it?
Pg = 0.198;
Pl = 0.818;
t = 1500;
y = Pg-Pl
f = abs(y);
P = int(f, t, 0, inf)
Can you check this code?

回答(1 个)

P = inf(size(f));
P(f==0) = 0;
You are integrating a vector of non-negative real constants from 0 to infinity. The integral of a positive constant to infinity is infinity. The integral of 0 to infinity is 0.
I have to wonder what anything in the first part of the code matters; you ignore all those variables.
I have to wonder if what you really want is trapz(f)

4 个评论

Thank you for your answer!
I try to simulate neural network and so the first part of the code are input parameters.
The integral, which I try to write is the output of neural network.
I'm novice in matlab and in neural network, in that case I didn't understand why did this error appear
int() is anti-differentiation. The first parameter must be a symbolic function or symbolic expression. the second parameter must be a symbolic variable to integrate over.
Your code builds numeric values through line 6 calculating K and I. Then on lines 7 and 8 you build numeric vectors without referring to anything you calculated before that. You subtract the two numeric vectors, you take the abs of the resulting numeric vector. Then you ask to int() the numeric vector, with respect to the numeric variable x. It makes no sense to integrate with respect to a numeric value. If it did make sense, then you would be integrating constants and the integral of those is (upper minus lower) times constant. With infinite upper bound and constant known to not be negative, the result would be infinite except where the constant is 0.
Notice that the variables you construct above that point are not used, so they will not affect the results.
Shallow Neural networks do not involve integration, they are transformation functions and matrix multiplication, done as many times as there are layers.
You could potentially want to model an infinite number of layers that were the same, and ask what the final value would be. I do not think that you would integrate for that: it would be more like calculating eigenvalues, doing calculations like infinite Markov chains.
Thank you for your explaining.
Since I'm new to this, I think I need to explore this topic more.

请先登录,再进行评论。

类别

在 帮助中心 和 File Exchange 中查找有关 Numerical Integration and Differentiation 的更多信息

产品

版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by