How did you call the function? When you get an error, report the ENTIRE error message, everyting in red. This lets us know how you called the function.
Just because you have a variable named ScanRate in your workspace does not tell MATLAB to automatically pass it into your function.
If you want the function to see the variable, then you NEED to pass it in. Call it like this:
[frq, amp, phase] = simpleFFT( signal, ScanRate);
So you need ot pass in TWO arguments to your function. They can have any names as you pass them in, but inside the function, now ScanRate will be defined.
If you don't, well, then MATLAB will generate an error - the one you got.
3 Comments
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/667968-user-defined-fft-function-parameter-not-recognized#comment_1169168
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/667968-user-defined-fft-function-parameter-not-recognized#comment_1169168
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/667968-user-defined-fft-function-parameter-not-recognized#comment_1169213
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/667968-user-defined-fft-function-parameter-not-recognized#comment_1169213
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/667968-user-defined-fft-function-parameter-not-recognized#comment_1169378
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/667968-user-defined-fft-function-parameter-not-recognized#comment_1169378
Sign in to comment.