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

4 vues (au cours des 30 derniers jours)
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

Réponse acceptée

KSSV
KSSV le 23 Oct 2020
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 commentaires
Teng Cheng Kang
Teng Cheng Kang le 27 Oct 2020
It worked successfully
Thank you very much for solving my problem

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by