アナログ入力の値をプロットしてそのグラフの最大振幅を求める方法が知りたい
조회 수: 3 (최근 30일)
이전 댓글 표시
しかし、これらを組み合わせたプログラムではエラーが出てしまい、どのように修正すれば良いかわかりません。
エラー内容
構造体の内容が非構造体配列オブジェクトから参照されています。
エラー: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)
댓글 수: 0
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Simultaneous and Synchronized Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!