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

조회 수: 1 (최근 30일)
Tom
Tom 2012년 1월 26일
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?

채택된 답변

Tom
Tom 2012년 1월 26일
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.

추가 답변 (2개)

the cyclist
the cyclist 2012년 1월 26일
I think instead of this
X = X(1/cutOff)
you meant this
X = X*(1/cutOff);

Walter Roberson
Walter Roberson 2012년 1월 26일
You should think of "clear all" as being like trying to reprogram the fuel injector computer on a car: if you don't have years and years of training, you probably should not even be considering doing it.

카테고리

Help CenterFile Exchange에서 Software Development Tools에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by