how to plot real-time fft of a signal acquired from arduino in matlab ?

15 views (last 30 days)
hello guys, i am a newbie in matlab signal processing and also dont know exactly where to post this question, as in, in which forum. please pardon me
i am preparing for my final year project.I have acquired a signal through arduino in matlab using matlab-arduino interface.
everything is working fine. but, when i try to take the fft of that signal in real time, an error pops out in the matlab command window : "Index extends matrix dimensions". and i am not able to find the error exactly and my project has come to a stand still. i have attached an image of my script...
i just want to get the peak amplitude of that signal...so please correct me if i have written the wrong script... it would be great if someone helps me to come out from this situation.
Thank you in advance.
  2 Comments
Geoff Hayes
Geoff Hayes on 29 Mar 2015
Rgv - it would be easier to just attach the code rather than an image of it. As well, you must have an idea of where the error is occurring. Can you copy and paste the complete error message (all of the red text) to your question?
The error message is telling you that you are trying to extract more data than exists from an array. An example would be
X = zeros(42,1);
X(1:100)
which generates the
Index exceeds matrix dimensions.
error. Something similar in your code could be the
d(1:500)
Are you sure that d, the input signal acquired from Arduino, has at least 500 elements?

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!