What is matlab's sampling rate through Arduino analog input?

조회 수: 20 (최근 30일)
Jun W
Jun W 2018년 5월 12일
댓글: Jun W 2018년 5월 24일
45 hz. In my case average sample time is 0.011008 sec/sample, roughly 45hz, while the Arduino's sampling rate is 10000hz.
  댓글 수: 4
Walter Roberson
Walter Roberson 2018년 5월 13일
I put a lot of effort into answering this question for you. I am disappointed that you deleted your part of the conversation.
Jun W
Jun W 2018년 5월 24일
sorry, didn't think those questions were valuable. let me undelete them

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2018년 5월 12일
Sensor data is numbers (or sometimes text strings). Sensors do not emit datetime objects. Most sensors do not return times at all. There are some sensors and some recording devices that time-stamp samples; they transfer that information a variety of formats. (For some sensors, resolution to minutes is more than enough; for other sensors, nanoseconds is too crude.)
MATLAB can read whatever data is sent. Sometimes converting the data to a useful format can be a bit of a nuisance (for example the encoding of GPS signals is a bit strange.) The datetime() 'InputFormat' and 'ConvertFrom' options are useful for doing conversions of various time-stamps.
However... your previous questions involve devices that do not emit timestamps, so I suspect that you are asking the wrong question.
  댓글 수: 6
Walter Roberson
Walter Roberson 2018년 5월 12일
You are using the arduino in a way that is easy to program and which is flexible. With simple instructions on the MATLAB side, you can tell it to read one particular voltage, and then you could read a digital pin, and then you might have it send a pulse width modulation to control a motor. Maybe then you would cycle through reading a digital pin until it flipped, indicating that the limiter switch on the motor had been reached. The interface is easy to use and does not require that you know how the arduino works, and you can use the analog inputs and outputs and any add-on boards in any order you want.
The trade off for this is that you have to command every I/O operation, not being able to easily create an input buffer or an output queue.
The arduino can be programmed to do specific operations, such as continually reading from a sensor and putting the information in a buffer to be transmitted as a batch to the host. That can be more efficient -- but it is not as flexible or as easy to code.
Walter Roberson
Walter Roberson 2018년 5월 13일
The piezo-electric device you mentioned does not appear to have a serial port: it looks like it just has connectors that you attach to a sensor that samples the voltage. It is not a requirement that the sensor be connected through serial port to MATLAB.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 MATLAB Support Package for Arduino Hardware에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by