Very new to this and need help making a contour plot that shows correlation between weight of powder, bullet seating depth, and group size.
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
First off im very new at this and attempting to figure my way though this. A little back story I am working on developing custom loads for my compition rifle. On a fourm another guy had a contour plot showing ideal loads based off his testing and I was hoping to replicate it (not able to use his program). For the inputs I would have 2 on the axis. One being the powder weight (in grains - gr) from 44.6 to 45.4 in 0.2 incriments. The second axis would be the bullet seating depth. This would be from 2.250" to 2.290" in 0.01" incraments. For the date i have loaded multiple batches of rounds. Out of these batches I will shoot and get a total group size for each.
Example:
44.6gr @ 2.290" = 0.912 MOA
44.8gr @ 2.290" = 0.661 MOA
45.0gr @ 2.290" = 0.995 MOA
45.2gr @ 2.290" = 1.200 MOA
45.4gr @ 2.29" = 0.663 MOA
I would continue this for each grain weight at the same seating depth. Then i would repeat the process with each grain weight at the next seating depth and so on untill I hvae gotten a group size for each combinination. I keep track of all of this on an excel spreadsheet and hope i can input that info as I would do this multiple times with different rifles and ammo load combinations.
(MOA is Minute of angle, used to measeure group size at any set distance, 1 MOA - 1.03" @ 100 yards)
I have added a photo of the plot I saw on the fourm. As it shows one axis has his powder weight, the other shows the seating depth (CBTO), the contour lines show group size and there are circles on there that show the measured group size for each batch of ammo. As the photo shows the smallest group size is trending towards 2.320" with aprox 44.6gr of powder. This would allow me to find the best combination of powder weight and seating depth to allow for the best group and have an allowable level or error between each batch.

Below is a spreadsheet of data I am hoping to plot. This is only one example as all valuble will change each time Run the test.

I have spend a few hours (not all at once) trying to figure this out and have not nowhere. I have not done the 2 hour training at this time but plan on it as soon as i have the window to do it completly. Is this something that would be easy to do and im just not getting it? If anyone could help me with this it would be greatly appreciated! Thank you!
0 comentarios
Respuestas (2)
Cris LaPierre
el 28 de En. de 2025
Editada: Cris LaPierre
el 28 de En. de 2025
If you are completely new to MATLAB, consider going through MATLAB Onramp. This is a free, self-paced 2-hr course that will introduce you to the basics of programming in MATLAB.
To create a contour plot in MATLAB, you need a 2D matrix of Z values (a value for each combination of X and Y values). You can optionally provide the X and Y values corresponding to each column and row. If you haven't already, look at the examples on the contourf documentation page.
Here's a quick example.
% Create vectos containing X and Y axis values
weight = 44.6:0.2:45.4;
CBTO = 2.250:0.01:2.290;
% Create a matrix of values for Z
[~,~,Z] = peaks(5);
% create contour plot
lvls = min(Z,[],'all'):1:max(Z,[],'all');
contourf(CBTO,weight,Z,lvls,'ShowText','on')
colormap(jet)
xlabel('CBTO (in)')
ylabel('Weight (gr)')
colorbar
% Add some randomly selected points
hold on
plot(CBTO([2 4 1 5 3 3 4 2]),weight([5 3 1 2 4 3 1 2]),'ko')
hold off
For a more specific problem, consider sharing an example data set (can attach this using the paperclip icon) and any code you have worked out. Without that, we can only provide general answers.
2 comentarios
Cris LaPierre
el 28 de En. de 2025
You just need to get your numbers into MATLAB. You say you have them in a spreadsheet. so look into readmatrix or readtable. Otherwise, you can create it manually.
Z = [1 2 3;
4 5 6]
Substitute your numbers into the code already shared to see the resutls.
Torsten
el 28 de En. de 2025
Movida: Torsten
el 28 de En. de 2025
What is the problem using the contourf command ? All you need is the matrix MOA - I created it using random numbers.
Varget = 44.6:0.2:45.4;
CBTO = 2.250:0.01:2.290;
MOA = rand(numel(CBTO),numel(Varget));
contourf(CBTO,Varget,MOA.')
0 comentarios
Ver también
Categorías
Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!