What is the best way to correlate theoretical vs real multivariate data?

1 visualización (últimos 30 días)
AbioEngineer
AbioEngineer el 31 de Oct. de 2022
Comentada: Ayush el 24 de Mayo de 2023
I have a matrix where each row corresponds to the concentration of 3 components. e.g. if I have a mixture of equal parts A, B, and C, then that row will be [0.333, 0.333, 0.333]. If it is 1 part A, 1 part B, and 0 parts C, then the row would be [0.5, 0.5, 0]
Then I measure the concentration of all these mixtures in real life, and store the data in a new matrix with identical dimensions. e.g. for the equal parts ideal mixture, let's say the actual measurement is more like [0.4, 0.3, 0.3] instead of [0.333, 0.333, 0.333]
There are many many many rows of these matrices, so how can I easily visualize that the overall agreement between the theoretical matrix and the measured matrix is sufficient? I don't need the absolute values of the concentrations to match within a threshold. I just need to see that if one of the components is much higher than the others in a theoretical mixture, it will manifest in a similar pattern in the measured concentrations. Like in the picture above, I color coded the general trends that are shared. When I add more of a component, the effect is generally seen in the eventual measurements
In reality there will be other components in the measured sample so the concentrations shouldn't match the theoretical matrix anyway.
I've attached a mat file containing the data in the image above
  1 comentario
Ayush
Ayush el 24 de Mayo de 2023
I understand that you want to see that if one of the components is much higher than the others in a theoretical mixture, it will manifest in a similar pattern in the measured concentrations.
You can do something like this
% calculate the relative concentration of each component in theoretical mixture
rel_prepared = prepared./sum(prepared, 1);
% calculate the relative concentration of each component in measured concentrations
rel_measured = measured./sum(measured, 1);
% plot the relative concentrations
bar([rel_prepared; rel_measured]')
legend('Comp 1', 'Comp 2', 'Comp 3')
xlabel('Sample')
ylabel('Relative concentration')
% compare the pattern of relative concentrations
if isequal(round(rel_prepared, 2), round(rel_measured, 2))
disp('The pattern is similar')
else
disp('The pattern is not similar')
end
We calculate rel_prepared which has the relative concentration of each component in the theoretical mixture and rel_measured which has the relative concentration of each component in the measured concentrations. rel_prepared and rel_measured matrices are used to plot the relative concentrations as a bar chart. Then, isequal() function is used to check if the pattern of relative concentrations in rel_preparedand rel_measured matrices is the same. If the pattern is the same, it will return 'The pattern is similar', otherwise, it will return 'The pattern is not similar'.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

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

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by