I have defined [Sensitivity], but I get an error message.

5 ビュー (過去 30 日間)
文宏
文宏 2022 年 6 月 13 日
コメント済み: 文宏 2022 年 6 月 14 日
clear all
close all
d = daq("ni")
ch = addinput(d, "Dev1", "ai1", "Accelerometer");
d.Rate = 44100;
ch.Sensitivity = 9.80665;
data = read(d, seconds(20));
plot(data.Time, data.Dev1_ai1);
ylabel("Acceleration (Gravities)");
%this code position is left up
Acceleration in App Designer on MATLAB as shown in the upper left of the attached photo, as shown in the lower left.
Reference URL
I want to graph it using [MeasurementTypes] as [Accelerometer].
The error message (in the attached photo on the upper right) says to define "Sensitivity", so I would like to use the code view of the reference URL: after the line break of addinput(~); at line 630, I would like to use the following line to define "Sensitivity".
switch measurementType
case 'Accelerometer'
Channels(1).Sensitivity=9.80665;
end
I have included the following
However, the
The variable 'Channels' is a structure, and the variable has been modified, but the value does not seem to be used. It is marked as.
Can anyone represent acceleration using App Designer?
I am using Matlab 2021b, NI_USB4431 and accelerometers in my environment.
I'm Japanese, so if you could use a simple syntax, that would be great...
Translated with www.DeepL.com/Translator (free version)

採用された回答

Walter Roberson
Walter Roberson 2022 年 6 月 13 日
In your app code, you need to store the output of the addinput() call into the variable Channels
Your code at line 665 calls addinput() but does not save the output of addinput()
  3 件のコメント
Walter Roberson
Walter Roberson 2022 年 6 月 13 日
The internal measurements would be volts, but after you set the Sensitivity, the readings you get should be in g
What model of accelerometer are you using?
文宏
文宏 2022 年 6 月 14 日
Probably because in the source code I did not set the y-axis for the case of acceleration.
Success! : [before.png] -> [after.png]
In addition, by default, "IEPE" also has a y-axis of voltage, is that correct...?
Environment: Impact Hammer
Sensitivity: 11.2 mv/N

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultichannel Audio Input and Output についてさらに検索

タグ

製品


リリース

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by