필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
Fernanda
Fernanda 2022년 10월 18일
답변: David Hill 2022년 10월 18일
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

답변 (1개)

David Hill
David Hill 2022년 10월 18일
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))

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by