필터 지우기
필터 지우기

compare two vectors plot

조회 수: 1 (최근 30일)
yousef Yousef
yousef Yousef 2016년 5월 29일
댓글: yousef Yousef 2016년 5월 29일
Hi,I have 2 vectors of length 1024, I want to take 100 samples equally spaced from each to make a comparison plot?

채택된 답변

the cyclist
the cyclist 2016년 5월 29일
편집: the cyclist 2016년 5월 29일

Of course, it is not possible to do this perfectly evenly spaced, and span the entire vector, so you have to make some compromise somewhere.

Here is one possibility. It will generalize to other cases:

% Some made-up data
N = 1024;
a = sort(rand(1,N));
b = sort(rand(1,N));
% How much to sample
N_sample = 100;
% Create an (almost) uniform sample
sampleIdx = round(linspace(1,N,N_sample));
a_sample = a(sampleIdx);
b_sample = b(sampleIdx);
% Plot
figure
plot(a_sample,b_sample)

Here is the result ...

  댓글 수: 1
yousef Yousef
yousef Yousef 2016년 5월 29일
Perfect ,Thanks,just I notice, the comparison should be done as:
t=1:100;
plot(t,a_sample,t,b_sample)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by