Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Matlab interpolation problem

Status
Not open for further replies.

richaphy

Member level 1
Joined
Mar 20, 2012
Messages
35
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
Greece
Activity points
1,592
I have a signal whose length is 7500 samples.
I process this signal and which then downsamples and now the length is 1937.
Now I wanted to reconstruct this signal back to original, for this I used interpolation function in matlab interp1.
For comparing the reconstructed signal (for error) I want to subtract the reconstructed signal from original. But this new reconstructed signal has 7502 samples. 2 samples extra matrices dont match, so cannot subtract.
I want to understand why it is happening, and how to get it correct, which means same no of signal as the original.
Thanks
Richa
 

From Mathworks:
vq = interp1(v,xq,method,extrapolation)

I'm not sure, but I believe parameter 'xq' defines the points at which the evaluation takes place, so you would define xq to be a vector of 7500 points.
 

I have defined xq to be of same time period and length as the initial signal.
Therefore I expect the reconstructed signal to have exactly same no of points as the original but here I am getting 2 more points.
 

It might have something to do with the fact that your downsampled signal has an irrational relationship to the original. How are you downsampling?
 

in = input(0:t);
Ts = sampling time of input
processed_in = function(in); % here I have done some processing which reduces the number of samples
length of procesed_in is 'tn'
xx = 0:Ts:tn(end); %xx = start:interval:end;
yip = interp1(tn,decimated,xx); % Reconstruct using function interp1
after this 'in' and 'yip' should be of same length, but yip has 2 samples more.
or we can say length of vector 'in' and 'xx' must be same
 

That doesn't really tell us anything, since "function" is a black box. As I said, the problem is possibly due to the irrational relationship. I don't know enough about the inner workings of the interp1 function to explain why it's giving you more samples than you ask for.
 

Sorry I cannot explain what is function.
However, here I have seen something extraordinary.
In this function along with many things I am also filtering the signal.
With one input if I filter the input then in the end I get equal XX and qip, if I dont filter it, qip is one sample more than xx!!!
probably you are right, the problem is something within this function.
Thanks for your time
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top