How can choose two point from signal and keep any data between them ?

i have a question if i have sine wave consist of five cycle and i want to choose point before cycle's number three and choose point after cycle's number four , i want Matlap plot in between two points choosed it without lost two cycles between it
Thanks for you

 Accepted Answer

So if i understand your question correctly what you're looking for is the colon operator (:). So depending on how you're selecting your two points you'll either start off with the index of the two points or whatever scale your x axis is in. Either way you'll need to find the indexes of the two points and use the colon operator to get points inbetween.
t = 0:.1:5;
y = sin(2*pi*t);
p1 = 10;
p2 = 40;
figure,subplot(2,1,1),plot(t,y)
subplot(2,1,2),plot(t(p1:p2),y(p1:p2))
while you'll probably have the points p1 and p2 defined as something in t and not index# you can still perform this with conditional operators of <, > or == and other functions.

More Answers (0)

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!