In Matlab, after plotting a figure then I select a range of area and replot again

조회 수: 4 (최근 30일)
Here is my program and figure, and I want to select a range of area and replot again finally calculate RMS
num1 = xlsread('2.1mm.csv','A2:A999999');
num2 = xlsread('2.1mm.csv','2.1mm','A3');
num3=(num1-num2)*86400;
num4 = xlsread('2.1mm.csv','c2:c999999');
plot(num3,num4);
set(gca, 'Fontname', 'Times New Roman','FontSize',24);
xlabel('time(sec)');
ylabel('g');
set(get(gca,'ylabel'),'rotation',0)
title('Spindle');
Sorry for the first consultation

채택된 답변

KSSV
KSSV 2020년 10월 23일
Yes you can very much do it....
If you have limits/ range for x-axis; you can limit your range in the existing plot using xlim, ylim, axis.
If you want to plot again and you want to restrict the range with data itself. Let val0 and val1 be your x-axis ranges.
idx = num3 >= val0 && num3 <= val1 ; % get indices
num3 = num3(idx) ;
num4 = num4(idx) ;
plot(num3,num4)
  댓글 수: 5
Teng Cheng Kang
Teng Cheng Kang 2020년 10월 27일
It worked successfully
Thank you very much for solving my problem

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by