Warning: Input argument might be unused and value assigned might be unused

14 次查看(过去 30 天)
I got a problem with my code, im trying to do a Fourier series function, but when i instance the function (y) says that might be unused and i dont undertand why.
Also, that happens to my result (s), when i put (s) as a "syms" says that might be unused
function [s]=FourierNuevo(y,T,B,max)
syms x n y s
p=(T-B)/2;
A0=(1/p)*int(y,[-p p]);
an=(1/p)*int(y*cos(pi*n*x/p),[-p p]);
bn=(1/p)*int(y*sin(pi*n*x/p),[-p p]);
As=an*cos(pi*n*x/p)+bn*sin(pi*n*x/p);
s = A0/2 ;
for k=1:max
s=s+subs(As,n,k);
end
end
This is my code. When i run it (y) is used like a constant value. Not like a function

回答(1 个)

Setsuna Yuuki.
Setsuna Yuuki. 2022-10-30
编辑:Torsten 2022-10-30
Holas.
Quizás es porque tu función
function [s]=FourierNuevo(y,T,B,max)
recibe la variable y, pero despues la estas reemplazando ya que declaras nuevamente y como tipo syms.
syms x n y s
Hello.
Maybe it's because your function
function [s]=FourierNew(y,T,B,max)
receives the variable y, but then you are replacing it since you declare again y as type syms.
syms x n y s

类别

Help CenterFile Exchange 中查找有关 Number Theory 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by