How to generate a signal at Specific time without re-sampling data into million points and free from any error.?

Hello, I am working on signal processing and noise characterization application. Time interval for signal is 1 sec. I have an event triggered at exactly 0.4568 sec(calculated by interpolation). Now i would like to generate some signal exactly at this time, however i don't want to re-sample my time to million interval and get a time with very small error.(by applying re-sampling i am getting an error < 0.0005 sec ) but i want signal at the specific time of 0.4568 sec without any error. I was wondering if any one can help me on finding a mathematical or shifting technique i could implement to remove any error.? I would code everything myself, I just want someone to let me know if any such technique exists? Solution implemented by anyone if they encountered this problem earlier? links to prior solved related questions and blogs will be very helpful.
Thanks, Joy

Answers (2)

You would have to change representation using the fixed point toolbox, as MATLAB cannot represent "0.4568" exactly in double precision.
Hey Walter, Thanks for the response. However what you said is ok if i want to display the number. I already have the required time. My problem is how to re-use this value to generate say dirac at this particular point. I have attached a part of my code which is used to generate dirac @ time; t_beta=0.4568
by using 0.000005 as sampling step i am able to generate dirac signal at t=0.4566. I want to avoid this and generate at exactly 0.4568
Is this possible with any numerical method, mathematical algorithm or shifting technique.? ----------------------------------------------
figure(1);
t=0:0.000005:1;
val=t_beta;
[N,bin]=histc(val,t);
index=bin+1;
if abs(val-t(bin))<abs(val-t(bin+1))
tclosest=t(bin);
index=bin;
else
tclosest=t(index);
end
x=zeros(1,length(t));
x(index)=1;
stem(t,x,'k','fill'),grid on;
axis([-0.2 Inf 0 1.1]);
-----------------------------------------

Asked:

Joy
on 13 Mar 2013

Community Treasure Hunt

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

Start Hunting!