MATLAB: Function definitions are not permitted…. trying to make an FFT thing

fftfunctionMATLAB

Function definitions are not permitted…. trying to make an FFT thing
I'm trying to get this working
close all
clear all
function[X,freq]=positiveFFT(x,Fs);
N=length(x);
k=0:N-1;
T=N/Fs;
freq=k/T;
X=fft(x)/N;
cutOff = ceil(N/2);
X = X(1/cutOff);
freq = freq(1:cutOff);
Any ideas?

Best Answer

I think it might be right. Just discovered that the function line has to be the top line of code otherwise it doesn't work.
Related Question