アナログ入力によって取得した複数のデータを個別のグラフにプロットしたい
古いコメントを表示
現在実行しているコードでは、オレンジ色と青色の線で重なってプロットされているため、subplotで描画したいです。
以下のようにMATLAB上で作成した式をsubplotで個別に描画することはできますが、時間が経過するに従ってx軸が移動するようにした現在実行しているコードでは、どの部分でどうやってsubplotを実装すればいいかわかりません。
t1 = (0:length(s1)-1)/Fs;
t2 = (0:length(s2)-1)/Fs;
subplot(2,1,1)
plot(t1,s1)
title('s_1')
subplot(2,1,2)
plot(t2,s2)
title('s_2')
xlabel('Time (s)')
現在のコード
s = daq.createSession('ni');
tx = daq.createSession('ni');
y = [y zeros(1,numCycle*s.Rate/ultraFreq)];
addAnalogOutputChannel(tx, 'Dev1', 'ao0', 'Voltage');
th=addlistener(tx, 'DataRequired', @queueMoreData);
addAnalogInputChannel(s,'Dev1', 'ai0', 'Voltage');
addAnalogInputChannel(s, 'Dev1', 'ai1', 'Voltage');
h = addlistener(s, 'DataAvailable', @plotData);
s.DurationInSeconds(1);
queueOutputData(tx, y');
startBackground(s);
現在のコードを実行すると得られるグラフをスクリーンショットで撮ったもの

採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Title についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!