Why do I receive errors using IFANBEAM for matrices with NaN

Technical Source
2 min readFeb 7, 2023

--

Why do I receive errors using IFANBEAM for matrices with NaN values in Image Processing Toolbox 7.2 (R2011a)?

I am trying to use the function IFANBEAM on a matrix with NaN values and receive a warning and an error depending on how many NaNs the matrix contains. An example of the code, warning and error message follow:

A = rand(10, 10);
b = 100;good_result = ifanbeam(A, b);A(10, 1:9) = NaN;some_result = ifanbeam(A, b);A(10, 10) = NaN;bad_result = ifanbeam(A, b);
Warning: NaN found in Y, interpolation at undefined values
will result in undefined values.  > In interp1 at 177   In fan2para>fan2paraInterp at 231   In fan2para>fan2paraInterp at 221   In fan2para at 196   In ifanbeam at 191   In my_program at 8  Warning: All data points with NaN in their value will be ignored.  > In polyfun\private\chckxy at 101   In spline at 54   In interp1 at 274   In fan2para>fan2paraInterp at 231   In fan2para>fan2paraInterp at 221   In fan2para at 196   In ifanbeam at 191   In my_program at 8  Error using chckxy (line 104) There should be at least two data points. Error in spline (line 54) [x,y,sizey,endslopes] = chckxy(x,y); Error in interp1 (line 274)         yiMat = spline(xCol.',yMat.',xiCol.').'; Error in fan2para>fan2paraInterp (line 231)         Fsh(i,:) = interp1(thetaDeg-gammaDeg(i),F(i,:),pthetaDeg,interp); Error in fan2para>fan2paraInterp (line 221)     P = fan2paraInterp(Fpad,d,gammaDeg,thetapad,... Error in fan2para (line 196) P = fan2paraInterp(F,d,... Error in ifanbeam (line 191) [P,oploc,optheta] = fan2para(F,d,... Error in my_program (line 8) bad_result = ifanbeam(A, b);

NOTE:-

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help , Finance Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

The ability to compute the inverse fan-beam transform using IFANBEAM function when the input matrix has a row of NaN values is not available in MATLAB.

The IFANBEAM code works by doing interpolation then by calling IRADON. In this example, the error happens during the interpolation step in FAN2PARA. When there are NaN values, interpolation fails. The warnings and errors come from code in MATLAB’s INTERP1 function. In some cases, INTERP1 can attempt to ignore NaNs to do its job interpolating. However, if there are too many NaNs, it cannot produce good results. In both cases, the resulting values will not be meaningful as the NaN values will just spread around.

SEE COMPLETE ANSWER CLICK THE LINK

--

--

Technical Source
Technical Source

Written by Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.

No responses yet