I have an error using walsh. It says

2 visualizaciones (últimos 30 días)
Teo
Teo el 28 de Nov. de 2024
Comentada: Image Analyst el 29 de Nov. de 2024
t1=-1;
t2=3;
N=2048;
t0 = (t2-t1)/N;
t = t1:t0:t2-t0;
xt = t.^3-4*t.^2+t+6;
n=4;
H=walsh(n,N); %%THERE IN AN ERROR. Error using () Too many input arguments. Expected 0 (in addition to System object), got 2.
K=t0*diag(H*H')
C=t0*H*xt'./K
xxt=C'*H;
ee=1/(t2-t1)*t0*sum((xt-xxt).^2);
ee=1/(t2-t1)*(t0*sum(xt.^2)-K'*C.^2);
close all; hold all;
plot(t,xt);
plot(t,xxt,'Color','red');
xlabel('t sek');ylabel('x(t)');

Respuestas (2)

Walter Roberson
Walter Roberson el 28 de Nov. de 2024
Editada: Walter Roberson el 28 de Nov. de 2024
walsh() is not the name of any Mathworks supplied function.
walsh() is the name of one File Exchange contribution, https://www.mathworks.com/matlabcentral/fileexchange/50202-walsh-n but that function expects only a single parameter.
walsh = comm.WalshCode();
If so, then the resulting object is invoked as a function using
H = walsh();
with no parameters. You might previously have done,
walsh.Length = N;
walsh.Index = n;
  6 comentarios
Walter Roberson
Walter Roberson el 29 de Nov. de 2024
And how is that variable created?
Image Analyst
Image Analyst el 29 de Nov. de 2024
@Teo Humar, wow -- it's really hard to get information from you so we can help you. And I'm not sure why. Did you overlook Walter's request:
What shows up for
which -all walsh
on your system, and on your colleague's system?
otherwise, why didn't you answer it? And please answer his last question about how you created the "walsh" variable. Help us to help you.

Iniciar sesión para comentar.


Image Analyst
Image Analyst el 29 de Nov. de 2024
I recreated your problem:
>> walsh
Execution of script walsh as a function is not supported:
C:\Users\Mark\Documents\MATLAB\work\Tests\walsh.m
Error in walsh (line 8)
H=walsh(n,N); %%THERE IN AN ERROR. Error using () Too many input arguments. Expected 0 (in addition to System object), got 2.
^^^^^^^^^^
The problem is that you named your script walsh.m. Give your m-file some different name, like testwalsh.m or something.
  2 comentarios
Walter Roberson
Walter Roberson el 29 de Nov. de 2024
S = [
"t1=-1;"
"t2=3;"
"N=2048;"
"t0 = (t2-t1)/N;"
"t = t1:t0:t2-t0;"
"xt = t.^3-4*t.^2+t+6;"
"n=4;"
"H=walsh(n,N);"];
writelines(S, 'walsh.m');
walsh
Execution of script walsh as a function is not supported:
/users/mss.system.xh7fl/walsh.m

Error in walsh (line 8)
H=walsh(n,N);
That does not say anything about "Too many input arguments. Expected 0 (in addition to System object), got 2.". In order to get that message, walsh() needs to be a system object.
Image Analyst
Image Analyst el 29 de Nov. de 2024
You're right - I was seeing the comment instead of an actual system error. I was confused because it was also in red.

Iniciar sesión para comentar.

Categorías

Más información sobre Test Model Components en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by