help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Interpolation problem


From: Terry Duell
Subject: Interpolation problem
Date: Sat, 24 Mar 2012 13:02:16 +1100
User-agent: Opera Mail/11.61 (Linux)

Hullo All,
I have a vector (y, 1012 elements) which has many zeros, in fact all but 24 of the values are zero. I would like to use the non zero values to interpolate values for the zero elements. I have used 'find' to locate the non zeros, but haven't been able to generate the intervening interpolated values, as I would like.
Here is what I have tried.

Ynz = find(y);
Yy = interp1(x,y,Ynz,'linear');

The vector x has size 1 1012,  and is the abcissa values of Y.
Y is the ordinate values and has size 1 1012, and Ynz (the nonzeros in y) has size 1 24.
Yy, the result of the interpolation has size 1 24.

What I want is a Yy, size 1 1012, which relates to my x and y, with all possible zeros interpolated from the non zero values in y.

Clearly, I have a misunderstanding of how 'interp1' is to be used. I have tried a few variations in an attempt to better understand how to get my required result, but it always returns Gy with size 1 24.

Is there a way of achieving my desired result?

Cheers,
--
Regards,
Terry Duell


reply via email to

[Prev in Thread] Current Thread [Next in Thread]