plot ''markers'' in graph
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Lotte Piek
am 10 Feb. 2023
Kommentiert: Sulaymon Eshkabilov
am 10 Feb. 2023
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 Kommentare
Akzeptierte Antwort
Sulaymon Eshkabilov
am 10 Feb. 2023
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
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!