Using fwrite in MATLAB to graph constant double values in Simulink Scope blocks?

ⅰ亾dé卋堺 提交于 2019-12-11 01:44:02

问题


I am currently trying to use UDP to send constant values from MATLAB to Simulink and then use Simulink to graph these values. Here is an image of the MATLAB code, Simulink block diagram and the graph that I am working with (note that the graph starts at a constant value of 0):

http://i.imgur.com/krkulyQ.png

In the MATLAB code I am using the fwrite function to send data to the Packet Input block which then outputs to the Scope block to graph the data. Specifically I would like to graph fractions and that is why I chose to use type double. When I run the MATLAB code the graph should jump from 0 to 50.5 as it is running in real time. However, it stays at 0.

I think there may be some problems with settings I used for the Packet Input Simulink block. Here are the settings:

http://i.imgur.com/Chc0qk8.png

I have tried this with type int8 and the graph changes according to what I input in the fwrite function. As you can see in the following image I graphed the value 50 using fwrite in int8:

http://i.imgur.com/Xzytfka.png

Here, I made changes to the "Input Packet size" and "Block output data types" since I am using int8 as shown in this image:

http://i.imgur.com/DUJ4eKB.png

If anyone knows what the problem is please let me know, thanks!

来源:https://stackoverflow.com/questions/16754867/using-fwrite-in-matlab-to-graph-constant-double-values-in-simulink-scope-blocks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!