insert several zeros between two samples

Hello, I have un signal xN with irregular sampling and i want insert zeros with a step of 100e-3 between my samples So i have my signal where my samples are for example: tN=[0.985,1.36,1.58,2.65,.....] And the number of zeros to put between my samples is searching like that for i=1:Tmax-1 a=round(((tN(i+1)-tN(i))/(te))-1); end So my aim is to create a signal y with the same irregular sampling that xN and between the samples, insert zeros with a step of 100e-3

답변 (1개)

Star Strider
Star Strider 2017년 11월 11일

0 개 추천

This seems to do what you want, given the sample time vector you provided:
tN=[0.985,1.36,1.58,2.65]; % Original Time Vector
v = min(tN) : 0.001 : max(tN); % Create Time Vector With 0.001 Steps
[Lv,nv] = ismembertol(v, tN, 0.0001); % Logical Vector ‘Lv’ & ‘nv’ Subscripts Into ‘v’ Matching ‘tN’
nv(Lv) = tN; % New Time Vector With Zeros Between Original Times

댓글 수: 3

nonet21
nonet21 2017년 11월 11일
편집: nonet21 2017년 11월 11일
I tested your script, I do not think that it is the good solution because I want to have a number of zero between all my two samples and there, with this script there is not a zero with a precise step between 2 samples, but between min and max of tN But i think we can use this script and insert a loop with ismembertol function
Star Strider
Star Strider 2017년 11월 11일
My script creates a uniformly-sampled vector between the minimum and maximum values of ‘tN’ with a step of 0.001. It then creates a vector of zeros (with the 0.001 spacing) and maps the existing values of ‘tN’ onto the values of ‘vn’ that correspond to those times.
I thought that is what you want.
nonet21
nonet21 2017년 11월 11일
I would like to first find the number of zeros to be able to put between each samples with a step of 100e-3 and then insert these zeros into a vector with the right time and not do a sampling directly between the min value and the max value, but all the time between the sample i and the sample i + 1 and then insert them into a vector with the right time space

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

카테고리

도움말 센터File Exchange에서 Audio Processing Algorithm Design에 대해 자세히 알아보기

질문:

2017년 11월 11일

댓글:

2017년 11월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by