필터 지우기
필터 지우기

Plotting doubt: making a curve with points

조회 수: 2 (최근 30일)
Andoni Mendialdua
Andoni Mendialdua 2014년 8월 22일
답변: Star Strider 2014년 8월 22일
Hi all, I have the following code:
figure
COPlin=Y./Yg;
plot(AATnew,COPlin)
axis([-10 80 0 1])
I want to make a curve, but Matlab is doing lot of lines between the points. What I want to obtain is a unique curve that put together all the points.
I would be glad if you could help me:)
  댓글 수: 2
Michael Haderlein
Michael Haderlein 2014년 8월 22일
what's the size of COPlin and AATew?
Andrew Reibold
Andrew Reibold 2014년 8월 22일
Not enough information. You could model with a polynomial but we couldn't possibly guess at what order it needs to be. You could model with moving line average curve smoothing but we have no idea the size of these arrays or their features/values to know what would work. You could try interpolation but we again dont know enough about your problem to know what would be best.

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

채택된 답변

Star Strider
Star Strider 2014년 8월 22일
I am not exactly certain what the problem is, but if my guess is correct, the sort function may be the solution:
AATnew = randi(90,20,1)-10; % ‘AATnew’ is a (20x1) array
COPlin = rand(20,1); % ‘COPlin’ is a (20x1) array
[Ms,Mi] = sort(AATnew); % Sort ‘AATnew’, keeping indices
figure(1)
plot(AATnew,COPlin,'-*') % Plot Original UNSORTED data
grid
figure(2)
plot(AATnew(Mi),COPlin(Mi),'-*') % Plot SORTED data
grid

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by