Is it possible to import an image like the Hjulström-Diagramm and plot my data in it?
3 views (last 30 days)
Show older comments
Hey guys, I want to import an image like the Hjulström Diagramm (https://en.wikipedia.org/wiki/Hjulstr%C3%B6m_curve#/media/File:Hjulstr%C3%B6ms_diagram_en.PNG) in matlab and plot the data I have got from my experiments in it. Is there any function/tool or possibilty to realize this without designing/plotting everthing by myself? Tank you :) Regards)
1 Comment
Answers (1)
Naga
on 26 Feb 2025
Hello david,
To overlay your experimental data on the Hjulström diagram in MATLAB, you can follow the approach you've outlined. Here are the steps:
- Use 'imshow' to display the image, and adjust the axes to match the scale of the diagram.
- Overlay your experimental data points on the diagram.
Attaching the code for the same:
img = imread('Hjulströms_diagram_en.png'); % Ensure the filename and path are correct
figure;
% Display the image with specified axis limits
imshow(img, 'XData', [0.01, 1000], 'YData', [0.01, 100]);
hold on;
% Set the axis properties
ax = gca;
set(ax, 'YDir', 'reverse'); % Reverse Y-axis to match the image's orientation
set(ax, 'XScale', 'log'); % Use log scale for X-axis
set(ax, 'YScale', 'log'); % Use log scale for Y-axis
% Set axis limits based on the diagram's expected range
xlim([0.01, 1000]); % Adjust X-axis limits (e.g., sediment size in mm)
ylim([0.01, 1000]); % Adjust Y-axis limits (e.g., velocity in cm/s)
% Example experimental data (replace with your own data)
sediment_size = [0.1, 1, 10]; % x values
velocity = [5, 20, 50]; % y values
% Plot the data on top of the image
plot(sediment_size, velocity, 'ro', 'MarkerSize', 8, 'MarkerFaceColor', 'r');
hold off;
0 Comments
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!