필터 지우기
필터 지우기

How to get a single series in legend when using plot() and interp1()

조회 수: 1 (최근 30일)
Nithya SIvasamy
Nithya SIvasamy 2017년 5월 17일
답변: Star Strider 2017년 5월 17일
yValues = interp1(E,QPM,xValues,'spline'); plot(E,QPM,'o',xValues,yValues);
when i Get a legend in the figure 2 series are there.But How to get a single series

답변 (1개)

Star Strider
Star Strider 2017년 5월 17일
Try this:
x1 = linspace(0, 1, 10);
y1 = rand(1, 10);
x2 = linspace(0, 1, 200);
y2 = interp1(x1, y1, x2, 'spline');
figure(1)
plot(x1, y1, 'o')
hold on
p2 = plot(x2, y2);
hold off
grid
legend(p2, 'Interpolated Data')
Experiment to get the result you want.

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by