|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
4D interpolationHi
I want to interpolate my values with the spline method. I did it with the command: vi = interpn(u,v,w,x,z,uu,vv,ww,xx,'spline'); where u,v,w,x are vectors of the same length defining the point with the value z. uu,vv,ww,xx are creaed by the ndgrid command. i got the error message: "wrong number or incorrectly formatted input argument". thanks for any help Thanatos |
|
|
Re: 4D interpolationOn May 20, 2008, at 3:52 AM, thanatos187 wrote: > > Hi > I want to interpolate my values with the spline method. I did it > with the > command: > vi = interpn(u,v,w,x,z,uu,vv,ww,xx,'spline'); > where u,v,w,x are vectors of the same length defining the point with > the > value z. uu,vv,ww,xx are creaed by the ndgrid command. i got the error > message: "wrong number or incorrectly formatted input argument". > > thanks for any help > Thanatos Can you post a simple example? Does the problem occur for "nearest", "linear", or "cubic" interpolation? Ben _______________________________________________ Help-octave mailing list Help-octave@... https://www.cae.wisc.edu/mailman/listinfo/help-octave |
|
|
Re: 4D interpolation
|
|
|
Re: 4D interpolationOn May 26, 2008, at 3:31 AM, thanatos187 wrote: > > Ben Abbott wrote: >> >> On May 20, 2008, at 3:52 AM, thanatos187 wrote: >> >>> >>> Hi >>> I want to interpolate my values with the spline method. I did it >>> with the >>> command: >>> vi = interpn(u,v,w,x,z,uu,vv,ww,xx,'spline'); >>> where u,v,w,x are vectors of the same length defining the point with >>> the >>> value z. uu,vv,ww,xx are creaed by the ndgrid command. i got the >>> error >>> message: "wrong number or incorrectly formatted input argument". >>> >>> thanks for any help >>> Thanatos >> >> Can you post a simple example? Does the problem occur for "nearest", >> "linear", or "cubic" interpolation? >> >> Ben >> >> It occurs for all methods. I want to use a spline interpolation. I >> have >> 1500 data points, so the length of the colum vectors are 1500. >> uu,vv,ww,xx, are matrixes of the size (10 10 10 10) >> >> thanatos I tried a 3D and 4D example. clear all v1 = 0:0.2:2; v2 = v1; v3 = v1; [x1,x2,x3] = ndgrid(v1,v2,v3); y = (x1.*x2 + x1.*x2.^2).*x3; z = interpn(x1,x2,x3,y,v1,v2,v3,'linear') v4 = v1; [x1,x2,x3,x4] = ndgrid(v1,v2,v3,v4); y = (x1.*x2 + x1.*x2.^2).*x3./(1+x4); z = interpn(x1,x2,x3,x4,y,v1,v2,v3,v4,'linear') Both of these work for me. Please verify they work for you as well. Ben _______________________________________________ Help-octave mailing list Help-octave@... https://www.cae.wisc.edu/mailman/listinfo/help-octave |
|
|
|
|
|
Re: 4D interpolationI've been following the brief thread on interpolation with interest.
Very helpful. However, I have a problem in which I need to interpolate (2d only) onto a surface that is not square. Given interp2: ZI = interp2 (X, Y, Z, XI, YI) I wish to interpolate (or maybe, if need be, approximate) Z to get ZI where XI and YI are not the same size. And neither are the original X and Y for that matter. interp2 does not allow this. Can anybody please suggest an alternative? Thanks, eric _______________________________________________ Help-octave mailing list Help-octave@... https://www.cae.wisc.edu/mailman/listinfo/help-octave |
|
|
Re: 4D interpolationOn Jul 3, 2008, at 11:31 AM, Eric S Fraga <e.fraga@...> wrote:
> I've been following the brief thread on interpolation with interest. > Very helpful. > > However, I have a problem in which I need to interpolate (2d only) > onto a surface that is not square. Given interp2: > > ZI = interp2 (X, Y, Z, XI, YI) > > I wish to interpolate (or maybe, if need be, approximate) Z to get ZI > where XI and YI are not the same size. And neither are the original X > and Y for that matter. interp2 does not allow this. Can anybody > please suggest an alternative? > By not the same size I assume you are implying X & Y are vectors, and Z is a 2D array? If so check out meshgrid or ndgrid. Ben _______________________________________________ Help-octave mailing list Help-octave@... https://www.cae.wisc.edu/mailman/listinfo/help-octave |
|
|
Re: 4D interpolationBen Abbott <bpabbott@...> writes:
> On Jul 3, 2008, at 11:31 AM, Eric S Fraga <e.fraga@...> wrote: > >> I've been following the brief thread on interpolation with interest. >> Very helpful. >> >> However, I have a problem in which I need to interpolate (2d only) >> onto a surface that is not square. Given interp2: >> >> ZI = interp2 (X, Y, Z, XI, YI) >> >> I wish to interpolate (or maybe, if need be, approximate) Z to get ZI >> where XI and YI are not the same size. And neither are the original X >> and Y for that matter. interp2 does not allow this. Can anybody >> please suggest an alternative? >> > > By not the same size I assume you are implying X & Y are vectors, and > Z is a 2D array? > > If so check out meshgrid or ndgrid. > > Ben By not the same size, I meant that size(XI) != size(YI). Pointing me to meshgrid was very helpful as it's made me realise that XI and YI need to be matrices. I had thought they could be vectors as X and Y are. Using meshgrid to create XI and YI (from my original vectors) gives me what I need and interp2 does the job. Many thanks for the pointer and for the very speedy response! eric _______________________________________________ Help-octave mailing list Help-octave@... https://www.cae.wisc.edu/mailman/listinfo/help-octave |
| Free Forum Powered by Nabble | Forum Help |