アナログ入力の値をプロットしてそのグラフの最大振幅を求める方法が知りたい
Afficher commentaires plus anciens
しかし、これらを組み合わせたプログラムではエラーが出てしまい、どのように修正すれば良いかわかりません。
エラー内容
構造体の内容が非構造体配列オブジェクトから参照されています。
エラー:programname(line 13)
disp(time.data)
組み合わせたプログラム
s = daq.createSession('ni');
ch = addAnalogInputChannel(s,'Dev1', 'ai1', 'Voltage');
s.Rate = 8000;
data = s.inputSingleScan;
disp(data)
s.DurationInSeconds = 2;
[data,time] = s.startForeground;
plot(time,data);
disp(time.data);
xlabel('Time (secs)');
ylabel('Voltage')
[up,lo] = envelope(time.data,300);
maxAmplitude = peak2peak(up-lo);
disp(maxAmplitude)
アナログ入力値をプロットするプログラム
s = daq.createSession('ni');
ch = addAnalogInputChannel(s,'Dev1', 'ai1', 'Voltage');
s.Rate = 8000;
data = s.inputSingleScan;
disp(data)
s.DurationInSeconds = 2;
[data,time] = s.startForeground;
plot(time,data);
disp(time.data);
xlabel('Time (secs)');
ylabel('Voltage')
グラフの最大振幅を求めるプログラム
load sensorData
t = 0:1/1000:3;
s1 = chirp(t,30,2,5).*exp(-(2*t-3).^2)+2;
t1 = (0:length(s1)-1)/Fs;
subplot(2,1,1)
plot(t1,s1)
title('s_1')
[up,lo] = envelope(s1,300);
maxAmplitude = peak2peak(up-lo);
disp(maxAmplitude)
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Simultaneous and Synchronized Operations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!