Does the INTERP1 function in MATLAB handle complex data with the "cubic" method?
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have "X" and "Y" data. "Y" is complex. I use the INTERP1 function with cubic interpolation to interpolate the data as follows:
Y_cubic = interp1(X,Y,Xi,'cubic');
plot(X,abs(Y),'b',Xi,abs(Y_cubic),'r')
In the resulting plot, I find there are some sharp peaks that do not seem correct.
Akzeptierte Antwort
MathWorks Support Team
am 27 Jun. 2009
This enhancement has been incorporated in Release 2006a (R2006a). For previous product releases, read below for any possible workarounds:
The cubic interpolation algorithm is not intended for complex data and hence does not behave well under certain circumstances when the data is complex. As a workaround, use the spline interpolation instead.
Y_spline = interp1(X,Y,Xi,'spline');
plot(X,abs(Y),'b',Xi,abs(Y_spline),'r')
Alternatively, you can split Y into real and imaginary parts, and then interpolate.
Yr = real(Y);
Yi = imag(Y);
Y_cubic = interp1(X,Yr,Xi,'cubic')+i*interp1(X,Yi,Xi,'cubic');
plot(X,abs(Y),'b',Xi,abs(Y_cubic),'r')
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Multirate Signal Processing finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!