Interpolation in mat-lab
1 回表示 (過去 30 日間)
古いコメントを表示
Hi, I have a vector with different values. Some of the values are zeros and sometimes they even come one after another. I need to plot this vector against another vector with the same size but i can't have zeros in it. What is the best way i can do some kind of interpolation to my vector and how do i do it? Thanks
1 件のコメント
採用された回答
Simon
2013 年 9 月 10 日
Hi!
What kind of interpolation do you need? Try "interp1"!
2 件のコメント
Simon
2013 年 9 月 10 日
Hi!
You have the time stamps of your frames, these are the "xi". Your "x" values are the time stamps where the frames are not blank. The "Y" are the non-zero values of your vector.
% vector of frames
vec = [1 5 6 3 0 4 0 5 7 0 3];
% set vector of time staps, fill in your values
xi = [1 2 3 4 5 6 7 8 9 10 11];
% get non-blank frames, fill in your vector values
nonblankframe = find(vec > 0);
% vector to interpolate
Y = vec(nonblankframe);
% time stamps of non blank frames
x = timestamps(nonblankframe);
% interpolate
yi = interp1(x,Y,xi);
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!