plot ''markers'' in graph
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi everybody,
I have a time vector and a data vector. Furthermore I have a vector with specific time points that indicated the start of a wave. I would like to plot them together to see if the start of the wave time is correct. At the moment I can't plot them together because of the fact that the vectors are not of the same length and furthermore plotting the specific time points wil give a line while I would like to have 'markers' or points. Can somebody help?
댓글 수: 0
채택된 답변
Sulaymon Eshkabilov
2023년 2월 10일
If understood your question correctly, this is what you are trying to do:
t = 0:.1:3; % Time
Data = exp(2*cos(t)); % Data vector
rng(1) % For this demo reproducibility purposes
ts = rand(1); % Wave starts at a time point
dt = 0.05; % Wave collected at a time step
tend = 5*rand(1); % Wave data collection ends at this time
tpoints = ts:dt:tend; % Specific time points at which the wave data was collected
Wave = sin(2*tpoints); % Wave Data vector
plot(t, Data, 'r--', 'DisplayName', 'Data with time')
hold on
plot(tpoints, Wave, 'bo-.', 'DisplayName', 'Wave with specific time points')
legend('Show')
xlabel('Time, [s]')
ylabel('Data & Wave')
grid on
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!