필터 지우기
필터 지우기

How to take 1 out of every 10 values ​​from a vector?

조회 수: 40 (최근 30일)
Jorge Armando Vazquez
Jorge Armando Vazquez 2024년 7월 10일 1:52
댓글: Manikanta Aditya 2024년 7월 10일 4:09
Hello, I have problems with a vector that I am working with, it has more than 10,000 elements, but I just need to know the trend of these, so I would like to take 1 out of every 10 values ​​to graph it, could you suggest a way to obtain it please?

답변 (1개)

Manikanta Aditya
Manikanta Aditya 2024년 7월 10일 2:00
To take 1 out of every 10 values from a vector in MATLAB, you can use indexing.
Here is how you can do it:
% Example original vector
original_vector = 1:10000; % Replace this with your actual vector
% Take 1 out of every 10 values
sampled_vector = original_vector(1:10:end);
% Now you can plot the sampled vector to see the trend
plot(sampled_vector);
title('Sampled Vector Trend');
xlabel('Index');
ylabel('Value');
Hope this helps!
  댓글 수: 4
Image Analyst
Image Analyst 2024년 7월 10일 3:18
To learn other fundamental concepts, invest 2 hours of your time here:
If this Answer solves your original question, then could you please click the "Accept this answer" link to award the answerer with "reputation points" for their efforts in helping you? They'd appreciate it. Thanks in advance. 🙂 Note: you can only accept one answer (so pick the best one) but you can click the "Vote" icon for as many Answers as you want. Voting for an answer will also award reputation points.
Manikanta Aditya
Manikanta Aditya 2024년 7월 10일 4:09
Thanks @Image Analyst! That was a really helpful comment.

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by