Effacer les filtres
Effacer les filtres

How do I create a scatter plot of every value combination of three vectors?

1 vue (au cours des 30 derniers jours)
Fernanda
Fernanda le 18 Oct 2022
I have two vectors A and B, and I want to plot each index of the first vector with each index of the other one. So plotting A1 with B1, A2 with B1, A1 with B3, A2 with B1...ect. Do I need to make a loop function for this? I also want to do a 3D plot of this with one of the axis being c = Ai + Bi.
A = [0.5:2:12];
B = [0:10:60];
these are the vectors I have

Réponses (1)

David Hill
David Hill le 18 Oct 2022
A = [0.5:2:12];
B = [0:10:60];
[a,b]=meshgrid(1:length(A),1:length(B));
scatter(A(a),B(b))
scatter3(A(a),B(b),A(a)+B(b))

Catégories

En savoir plus sur Scatter Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by