two lines on the same graph

1 回表示 (過去 30 日間)
Payaam Khalid
Payaam Khalid 2022 年 12 月 6 日
回答済み: Askic V 2022 年 12 月 6 日
clear all; close all;
a = arduino('COM3', 'uno') % or use COM port
tic %start timer
max_samples = 10; % how many times do we check the sound sensor?
tic %start timer
for i = 1:max_samples
moisture_data(i) = readVoltage(a,'A0');
time_data(i) = toc;
end
plot(time_data, moisture_data)
readVoltage(a,'A0') is a moisture sensor this loop takes 10 samples from the sensor then graphs it i want to pause for 30 seconds put the sensor in water and run this loop again making a second line on the same set of axes as the first how do i do that

回答 (1 件)

Askic V
Askic V 2022 年 12 月 6 日
You need to use hold. Please have a look in the documentation
https://www.mathworks.com/help/matlab/ref/hold.html

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by