Error during FFT output argument

I've recently been given a file that I've seen work, however on my computer I get an error
Output argument "yout" (and maybe others) not assigned during call to "step".
Error in read_and_FFT_1 (line 7)
Fs =1/step; % in Hz
What is causing this problem? Here's the full code:
% clear all,
% A=load('data_file.txt');
% plot(A);
% y=A;
% step=1e-8; % sec
Fs =1/step; % in Hz
L=length(y);
NFFT = 2^nextpow2(L) *2^1;
Y = fft(y,NFFT)/L;
f1 = Fs/2*linspace(0,1,NFFT/2+1); % abs RF freq.
Y1=2*abs(Y(1:NFFT/2+1)); % FFT ampl= spec. density
plot(f1,Y1,'k','LineWidth',1),
grid on, axis tight
%%%%%%%%%% zoomed plot %%%%%%%%%%%%%%
% tic
% n=[35+28e-6 35+38e-6]; % range, MHz
% n1=round(n/50 *length(f1));
% plot( f1(n1(1):n1(2)), Y1(n1(1):n1(2)) ,'k','LineWidth',2); axis tight;
% toc

 Respuesta aceptada

Walter Roberson
Walter Roberson el 28 de Feb. de 2017
The line
% step=1e-8; % sec
is commented out. If the leading % were removed, it would assign a numeric value to the variable named step
You then have the line
Fs =1/step; % in Hz
You have not assigned a numeric value to step, so MATLAB looks on the path and sees that there is a function named step() and assumes that you meant
Fs =1/step()
This calling of step() with no inputs is generating an error because the step() function it finds needs at least 1 input.

1 comentario

Swapneal Jain
Swapneal Jain el 28 de Feb. de 2017
Thank you for the simple answer, I'm new to matlab as you can tell and the program ran just fine after I removed the %. Now I just have to figure out the out of memory error that occurs when actually running the program

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Fourier Analysis and Filtering en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 28 de Feb. de 2017

Comentada:

el 28 de Feb. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by