Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
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

Antworten (1)

David Hill
David Hill am 18 Okt. 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))

Community Treasure Hunt

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

Start Hunting!

Translated by