How to create a vector in Matlab

조회 수: 1 (최근 30일)
Jórdan Venâncio Leite
Jórdan Venâncio Leite 2021년 4월 12일
댓글: Jórdan Venâncio Leite 2021년 4월 13일
1 -> I need to create a vector in Matlab that goes from 1 to 500 and has 0.00462962962962962962962962962963 of interval between each element. How do i do that?
2 -> I need to insert tree zeros between every 5 positions of a vector. For example:
v = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15...]
I need:
t = [1 2 3 4 5 0 0 0 6 7 8 9 10 0 0 0 11 12 13 14 15...]
Thanks in advance

답변 (1개)

DGM
DGM 2021년 4월 12일
편집: DGM 2021년 4월 12일
For the first part:
x=1:1/216:500;
for the second part, what exactly do you need the spaces for? The extra spaces don't actually do anything. Are you trying to create a numeric vector with spaces, or is this for display only?
  댓글 수: 7
DGM
DGM 2021년 4월 13일
Then set n=1080 and nz=1080, run that on your y-data.
For the x-data, the timesteps are all identical, so you'll have to decide whether you want to extend the timebase or make the timestep shorter.
You'll have to decide what the relationship between x and y is going to be if you insert a bunch of artificial samples into the dataset.
Jórdan Venâncio Leite
Jórdan Venâncio Leite 2021년 4월 13일
Thanks for your answer DGM! I will try it!!

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

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by