Equivalent time sampling in Matlab

I am sending data from fpga (nios ii processor) to serial port and Matlab access the serial port and plot real time graph. The Nios II is 50MHz, so it has no issue to receive the data from fpga which is 50Hz
If the serial port receive rate is just 8Hz, but the data sent to serial port is 50Hz, what approach is Matlab using to plot the graph? Does it have anything to do with equivalent time sampling (ETS)? I could not find any links between Matlab and ETS, correct me if I am wrong.
Appreciate any inputs.. thank you

7 Comments

What size is your sample? Depending on the operating system and hardware, MATLAB can be configured up past 256000 baud, 25600 bytes per second. An 8 Hz limitation would imply 3200 bytes per sample.
Data transfer rates beyond 9600 baud (960 bytes per second, 120 bytes per sample at 8 Hz) may require higher quality serial lines and hardware flow control.
Thank you for your reply, Walter. For your information, I sent 48 characters in one uart() function call and I have twelve of these function calls in one execution (48*12=576).
I wanted to know,
1. In what condition, will Matlab use equivalent time sampling (ETS) instead of real-time sampling?
2. Since it is stated that there is a limitation of 120 bytes per sample at 8 Hz, because I am still getting the correct sinusoidal waveform, so I wanted to know what is the reason behind this, is it because Matlab uses ETS or??
Thank you very much in advance.
MATLAB does not use equivalent time sampling by default. I do not know if any of the Mathworks supplied routines support ETS.
120 bytes per sample at 8 Hz is a matter of serial port rate. If your serial port rate is set to 46080 or higher, such as the standard rate 57600, then you would be able to read all 576 bytes at 8 Hz.
I do not find any uart() call in any of the MATLAB products.
Thank you, the incoming signal is 50Hz, the serial port receive rate is only 8 Hz, what will Matlab do in order to plot the graph?
Hz is not used to measure serial port receive rates: bits per second, or baud (symbols per second), are used to measure receive rates.
When RS232 signalling is used, each character transmitted requires a start bit and a stop bit. When the characters are 8 bits, that would require a total of 10 transmitted bits. If your receiver was operating at 8 Hz you would only be getting through 8/10 of a character per second, and would require about 12 minutes to transfer 576 characters.
The slowest traditional receive rate is 50 baud, 5 characters per second. You would have to use a flexible chip to configure a rate as low as 8 baud.
I suggest that you recheck, as it seems more likely that your equipment is operating at 8 MHz rather than 8 Hz.
want2know
want2know on 28 Jul 2015
Edited: want2know on 28 Jul 2015
Thank you for your kind reply... I did set the baud rate to be 11.5kbps, then I send the data from Altera Nios hardware to serial port, Matlab access the serial port and plot the graph, this assumption is used to calculate the receive rate
"packets are sent out at a fixed dt rate which is very accurate because it is clocked by the Altera Nios. The dt period is calculated by looking at the number of packets received over a long period. The first 100 packets are ignored as Matlab might be busy emptying the serial buffer during this startup period, so 1/dt is the receive rate that I obtained (8 Hz)
dt = (t(end) - t(100)) / (length(t) - 101);
The incoming signal is 50 Hz, which means I am supposed to see a sinusoidal waveform every 0.02 seconds, from the results, I still can see a sinusoidal waveform but a complete sinusoidal waveform is plotted every 12 seconds, so I was thinking is it that Matlab use Equivalent Time Sampling to plot this result in my case? Or do you have any idea in mind so I can google for the details?
Thank you in advance.
115200 baud would be 11520 characters per second. That should be enough to get 20 groups of 576 characters if the serial configuration is set right. Please show the MATLAB code for your serial setup.
You have not mentioned anything about how you are doing the plotting. I doubt that any Equivalent Time Sampling is involved, but you have not described the plotting calls. Are you using a Simulink Scope block? If so then how do you have it configured?

Sign in to comment.

Answers (0)

Categories

Asked:

on 24 Jul 2015

Commented:

on 28 Jul 2015

Community Treasure Hunt

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

Start Hunting!