Clear Filters
Clear Filters

plot ''markers'' in graph

1 view (last 30 days)
Lotte Piek
Lotte Piek on 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?

Accepted Answer

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 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

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!