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

 채택된 답변

Walter Roberson
Walter Roberson 2017년 2월 28일

0 개 추천

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

Swapneal Jain
Swapneal Jain 2017년 2월 28일
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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

태그

질문:

2017년 2월 28일

댓글:

2017년 2월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by