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 ExchangeFourier Analysis and Filtering についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by