Borrar filtros
Borrar filtros

Obtain data values for a vector plotted on top of a colorplot

1 visualización (últimos 30 días)
Charlie Milford
Charlie Milford el 24 de Ag. de 2022
Respondida: Moksh el 28 de Ag. de 2023
I have plotted a colour plot of current speed, with depth on the y axis and time on the x axis.
I have a line which tracks tidal elevation, with varying depths across time within the water column.
My question is: how do I recieve current speed values for each time step along my line.
Figure shown below is what I have produced so far, I'm attempting to measure the difference in current speed experienced by both the soid and dotted black lines.
  1 comentario
Charlie Milford
Charlie Milford el 24 de Ag. de 2022
Any suggestions? I think it should be relatively simple I just cant think how it would be done

Iniciar sesión para comentar.

Respuestas (1)

Moksh
Moksh el 28 de Ag. de 2023
Hi Charlie,
As per my understanding you have plotted the above graph in your code. So you might already have the current speed values on the y-axis and a constant speed value represented by the dotted line. So for the following part of your query you can simply create a difference vector of the same dimensions as y and use the 'abs' function of MATLAB to calculate their absolute difference.
You can you the following example code for this
% Your plotted speed values (I am using 100 random values)
y = rand(1, 100);
% Dotted line value (Constant speed value represeneted by the dotted line)
y_dot = 0.4;
% Number of speed values (Dimensions of the y-vector)
sz = size(y);
diff = zeros(sz);
for i = 1 : sz(2)
diff(i) = abs(y(i) - y_dot);
end
You can use the following documentation for further understanding of for-loops and 'abs' function in MATLAB.
Hope this helps!

Categorías

Más información sobre Contour Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by