using voltage sensor in program code

조회 수: 6(최근 30일)
Rawaa Almajeez
Rawaa Almajeez 2021년 10월 25일
댓글: Sulaymon Eshkabilov 2021년 10월 26일
I have voltage sensor and current sensor that I want to creat m-file program and use their reading. How can exactly read them and right a program code to descripe them?

채택된 답변

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 10월 26일
There are a few different ways to obtain signal readings into matlab workspace.
(1) using [out] block (Simulink/Sinks) connected to the sensor readings block signal
(2) using [To Workspace] block (Simulink/Sinks) connected to the sensor readings block signal
(3) using [Scope] block (Simulink/Sinks) by adjusting its properties to save the signals into matlab workspace as an array or stucture array
Moreover, you can execute your simulink model from your matlab script using sim() and obtain all of the signal data.
  댓글 수: 2
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 10월 26일
Most Welcome!

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

추가 답변(1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 10월 26일
(1) Make sure that you have Data Acquisition toolbox installed. And if it is there, then you can check the followings.
(2) find out what particualr DAQ system/data logger is connected to your computer. This can be checked using:
daqlist
If your matlab (computer) can recognizes and sees your DAQ system, then you can acquire your sensor readings via your connected DAQ system, e.g.:
D = daq('...') % DAQ system vendor name
Typical workflows include some of the following steps:
(1) Discover hardware devices using the daqlist function
(2) Create a DataAcquisition object using the daq function
(3) Add device channels
(4) Add device connections
(5) Set DataAcquisition and channel properties
(6) Perform on-demand operations
(7) Perform clocked operations
(8) Initiate background clocked operations
Here is a good documentation how to acquire the data via DAQ from the sensors:
  댓글 수: 1
Rawaa Almajeez
Rawaa Almajeez 2021년 10월 26일
I might write it in a wrong way! I meant I have a voltage sensor block and current sensor block in my simulink circuit and I want to write a program using their reading. How should I do that

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

Community Treasure Hunt

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

Start Hunting!

Translated by