Borrar filtros
Borrar filtros

plot ''markers'' in graph

1 visualización (últimos 30 días)
Lotte Piek
Lotte Piek el 10 de Feb. de 2023
Comentada: Sulaymon Eshkabilov el 10 de Feb. de 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?

Respuesta aceptada

Sulaymon Eshkabilov
Sulaymon Eshkabilov el 10 de Feb. de 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 comentarios
Lotte Piek
Lotte Piek el 10 de Feb. de 2023
thanks!
Sulaymon Eshkabilov
Sulaymon Eshkabilov el 10 de Feb. de 2023
Most welcome!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by