Search Comments and Ratings

go

Comments and Ratings

   
Date File Comment by Comment Rating
27 Aug 2009 Binary Search for numeric vector Search given value in a sorted vector, returns the index of location where the value is found. Author: Dr. Murtaza Khan C. Chaya

Works great. Want to use 'index' rather than 'x(index)' to find the location, as in :

x = sort(randint(1,100,[0,400]));
sval=12;
index = binarysearchasc(x,sval);
index

20 Jul 2009 Quadtree decomposition (Encoding) and Decoding of RGB Image Quadtree decomposition (Encoding) and Decoding of RGB Image of size M-by-N-by-3 (No toolbox required Author: Dr. Murtaza Khan Khan, Dr. Murtaza

New version has been uploaded. Fee free to use and comment on this program.

Thanks
Author

18 Jul 2009 Quadtree decomposition (Encoding) and Decoding of RGB Image Quadtree decomposition (Encoding) and Decoding of RGB Image of size M-by-N-by-3 (No toolbox required Author: Dr. Murtaza Khan Khan, Dr. Murtaza

I updated the new version on 18-July, which includes two missing files delsparsekeybyxANDy.m and trimsparse.m. Please wait few days so that Matlab can approve and upload the new version in few days.

thanks
Author

15 Jul 2009 Euler angles to Quaternion Conversion (for six basic sequence of rotations) Allowed rotations sequences: xyz, xzy, yxz, yzx, zxy, zyx Author: Dr. Murtaza Khan Tursa, James

This submission has the following problems:

1) The code only covers six of the twelve possible triple rotation sequences. It leaves out the xyx, xzx, yxy, yzy, zxz, and zyz sequences.

2) Typing 'help eulertoquat' doesn't give you much of anything useful. Only a brief description of the function is given. All of the critical necessary information that should be in the help (quaternion convention (is scalar first or last?, etc), what units are acceptable for the euler angles, what order are the arguments, etc, etc) are not displayed. You have to manually edit the file eulertoquat.m to discover all of this.

3) The supplied testeuler2quat.m file doesn't work at all. First, it clears your command window, closes everything, and clears your workspace (very bad). Then it exits with an error because the function it calls, namely euler2quat, does not match the actual function name in the submission, eulertoquat. After changing the testeuler2quat.m file so that it called eulertoquat, it bombed again. This time because the number of output arguments did not match up. So after fixing that up, it bombed *again*. This time because the quaternion multiply routine func_QuatMult was missing ... it did not match the supplied function quaternionmul.m. So after fixing *that* up the test routine finally ran, but the results are pretty much useless as a test. Other than checking to see that the norm of the result is 1, nothing is supplied to check the correctness of the result.

4) There is no inverse function supplied. For example, a quattoeuler.m function would be appropriate. That would at least allow the user to check the results for consistency.

5) The code is not written as efficiently as it could. e.g., the current code creates several temorary variables, does the multiply into more temorary variables, and then gathers up the temorary variables and concatenates them into a single result to return. But by simply preallocating the quaternion result and then putting the calculation results directly into the return variable I was able to save about 5% off the running time.

6) The code is not vectorized! That is, you cannot input a vector or matrix of inputs and get a vector or matrix of outputs. You would have to call this function in a loop to get the results for a vector or matrix of inputs.

7) I don't usually question other people's ratings, but in this case I must. How can this submission possibly get 4 and 5 stars from others when it doesn't even run out of the box? "... easy to use ..." ??? What is going on here?

I spot checked a couple of cases against other code I have (see below), and I did check the formula used for the quaternion multiply, and it appears to be correct. But if you want to see a *much* better submission for converting between quaternions, direction cosine matrices, and euler angle sequences that *is* vectorized and *does* have a useful help, I highly advise that you download this other submission by John Fuller:

http://www.mathworks.com/matlabcentral/fileexchange/20696

James Tursa

10 Jul 2009 Binary Search for numeric vector Search given value in a sorted vector, returns the index of location where the value is found. Author: Dr. Murtaza Khan O'Connor, Derek

Dear Dr Khan,
The comma should not have been included at the end of the link

http://www.derekroconnor.net/NA/Notes/NA-4-Latex.pdf

Please note that your Binary Search of rows of m by n matrix
also suffers from this error.

http://www.mathworks.com/matlabcentral/fileexchange/9095

Derek O'Connor

10 Jul 2009 Binary Search for numeric vector Search given value in a sorted vector, returns the index of location where the value is found. Author: Dr. Murtaza Khan O'Connor, Derek

Dear Dr Khan,

Your Binary Search has an error that occurs not only
in most student programs but in some of the best books.
See, for example, Jon Bentley, "Programming Pearls",
Addison-Wesley, 1986, pages 35 to 48.

The midpoint of an interval [a,b] may be calculated as
m1 = (a+b)/2 or as m2 = a+(b-a)/2. Mathematically, m1 == m2,
but computationally this may not be true.

Your program uses the first calculation and it goes wrong
when a and b are so large that (a+b) overflows. Here is an example, using your variable names:

>> from = intmax-10; to = intmax;
>> mid1 = round((from + to)/2); [from mid1 to]
ans =
  2147483637 1073741824 2147483647
>> mid2 = round(from+(to-from)/2); [from mid2 to]
ans =
  2147483637 2147483642 2147483647

See the notes on this topic at :

http://www.derekroconnor.net/NA/Notes/NA-4-Latex.pdf,
pages 25, 26, 40, 41

Derek O'Connor

12 Jun 2009 Binary Serach of rows of M-by-N Matrix Binary Search that is based on sum of column values of rows of input M-by-N Matrix Author: Dr. Murtaza Khan cho, woonsang

sorry I realized that it should be ordered by the sum. thank you

12 Jun 2009 Binary Serach of rows of M-by-N Matrix Binary Search that is based on sum of column values of rows of input M-by-N Matrix Author: Dr. Murtaza Khan cho, woonsang

It works for small matrices, but it does not work for some larger matrices. Please run and check the following statement:

bsearchmatrows([5 6; 2 3 ; 1 2 ; 1 1; 0 0],[5 6])

ans =
     []

Obviously it should return '1', but it doesn't. Please help us fix this bug. Thank you,

30 May 2009 Quadtree decomposition (Encoding) and Decoding of RGB Image Quadtree decomposition (Encoding) and Decoding of RGB Image of size M-by-N-by-3 (No toolbox required Author: Dr. Murtaza Khan , hbu

excellent

24 Apr 2009 Quadtree decomposition (Encoding) and Decoding of RGB Image Quadtree decomposition (Encoding) and Decoding of RGB Image of size M-by-N-by-3 (No toolbox required Author: Dr. Murtaza Khan Robin

Really good work !!!
would you please send me the qt3ddecomp m-file ?
thank you so much
Robin

15 Apr 2009 Quadtree decomposition (Encoding) and Decoding of RGB Image Quadtree decomposition (Encoding) and Decoding of RGB Image of size M-by-N-by-3 (No toolbox required Author: Dr. Murtaza Khan Gérenton, Pierrick

good work !!!
would you please send me the qt3ddecomp mfile ?
thank you

02 Apr 2009 Quadtree decomposition (Encoding) and Decoding of RGB Image Quadtree decomposition (Encoding) and Decoding of RGB Image of size M-by-N-by-3 (No toolbox required Author: Dr. Murtaza Khan i, yxlvvv

great work
would you send me the mfile from qt3ddecomp.p please...,my e_mail:yxlvvv@qq.com thank you

24 Nov 2008 Quadtree decomposition (Encoding) and Decoding of RGB Image Quadtree decomposition (Encoding) and Decoding of RGB Image of size M-by-N-by-3 (No toolbox required Author: Dr. Murtaza Khan Basheer

great work
would you send me the mfile from qt3ddecomp.p please...???

24 Oct 2008 Quadtree decomposition (Encoding) and Decoding of RGB Image Quadtree decomposition (Encoding) and Decoding of RGB Image of size M-by-N-by-3 (No toolbox required Author: Dr. Murtaza Khan Setiardi, Saksono

may i have the mfile from qt3ddecomp.p please...???

30 Jul 2008 N Dimensional Cardinal Spline (Catmull-Rom) Spline Interpolation N -Dimensional Cardinal Spline (Catmull-Rom) Spline Interpolation Author: Dr. Murtaza Khan Wu, Di

very helpful, hahahha

21 Jul 2008 Bezier Interpolation in N-Dimension Space Bezier interpolation for given four control points. Each control point can be in N-Dimensional. Author: Dr. Murtaza Khan Delannoy, Pierre

Very good !
However we can regret that it cannot make Bezier regression over more than 4 points.
It should be improved.
Thank you

03 Apr 2008 Search closest value in a vector search value in sorted vector and find index and value with respect to vector that is equal or clos Author: Dr. Murtaza Khan varma, akash

Kindly trap the case where the no. to be searched is outside the bounds. Eg:

x = [23,45,67,89,78,90]
[i,cv] = searchclosest(x,91)

gives error

?? Index exceeds matrix dimensions.

Error in ==> searchclosest at 49
y=x(to:from); %vector to be serach for closest value

18 Mar 2008 Search closest value in a vector search value in sorted vector and find index and value with respect to vector that is equal or clos Author: Dr. Murtaza Khan Huetter, Schneider

thanks!

31 Jan 2008 2D Cubic Beizer Curve Evaluate and plot 2D cubic bezier curve for given four control points. Author: Dr. Murtaza Khan Kyosev, Y.

fine and simple example. for the beginners two sentences theory could be usefull, but ... ther is enough in www.
thank you.

14 Jan 2008 Bezier Interpolation in N-Dimension Space Bezier interpolation for given four control points. Each control point can be in N-Dimensional. Author: Dr. Murtaza Khan R, Denis

Neat little program. Very helpful. Thanks.

16 Dec 2007 Approximation of Circle Using Cubic Bezier Curve Approximation of unit radius circle with four parametrix bezier curves Author: Dr. Murtaza Khan pourali, payam

plz send me.

03 Dec 2007 Approximation of Circle Using Cubic Bezier Curve Approximation of unit radius circle with four parametrix bezier curves Author: Dr. Murtaza Khan hinbon, fung

30 Nov 2007 Binary Serach of rows of M-by-N Matrix Binary Search that is based on sum of column values of rows of input M-by-N Matrix Author: Dr. Murtaza Khan J., Amfy

Very useful for searching rows in large 2-D matrices.

29 Nov 2007 Differential Encoding/Decoding Basic Differential Encoding/Decoding of input vector of numeric values Author: Dr. Murtaza Khan Saifi, Israil

02 Nov 2007 Merge two sorted vectors into a sorted vector Merge two sorted vectors 'a' and 'b' into a sorted vector 'c' Author: Dr. Murtaza Khan R., Jhonty

very helpful to implement Merge-Sort algorithm

02 Nov 2007 Differential Encoding/Decoding Basic Differential Encoding/Decoding of input vector of numeric values Author: Dr. Murtaza Khan kkhan, jamill

05 Oct 2007 Approximation of 2-D Data by Natural Cubic Spline Approximation (Data Fitting) by Natural Cubic Spline. Author: Dr. Murtaza Khan Hsiao, Rita

But I need the advanced version which is used
in the N-D space. However, the link is failed. Would you offer it again?
Thanks a lot!!

22 Sep 2007 Quadtree decomposition (Encoding) and Decoding of RGB Image Quadtree decomposition (Encoding) and Decoding of RGB Image of size M-by-N-by-3 (No toolbox required Author: Dr. Murtaza Khan salem, selma

can I have a mfile qt3ddecomp to better understand a method.

07 Jul 2007 Binary Search for numeric vector Search given value in a sorted vector, returns the index of location where the value is found. Author: Dr. Murtaza Khan R, Johnty

07 Jul 2007 Search closest value in a vector search value in sorted vector and find index and value with respect to vector that is equal or clos Author: Dr. Murtaza Khan .., .

thank you

02 Jul 2007 Quadtree decomposition (Encoding) and Decoding of RGB Image Quadtree decomposition (Encoding) and Decoding of RGB Image of size M-by-N-by-3 (No toolbox required Author: Dr. Murtaza Khan Ince, Taner

10 Jun 2007 N Dimensional Cardinal Spline (Catmull-Rom) Spline Interpolation N -Dimensional Cardinal Spline (Catmull-Rom) Spline Interpolation Author: Dr. Murtaza Khan kordi, kobra

hello,I'm student of geodesy.
I want interpolate 3-D data of levelling but don't know about interpolation of irregular data. please help me!?

31 May 2007 Bezier Interpolation in N-Dimension Space Bezier interpolation for given four control points. Each control point can be in N-Dimensional. Author: Dr. Murtaza Khan Hartmann, Christian

Thanks. It did the trick for me.

29 May 2007 Search closest value in a vector search value in sorted vector and find index and value with respect to vector that is equal or clos Author: Dr. Murtaza Khan Shvorob, Dimitri

Point taken; my concern is limited applicability of the code - to distinct-valued vectors, really. Btw, here's a binary-search imlementation, submitted to FEX in 2005.
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=7552&objectType=file

26 May 2007 Search closest value in a vector search value in sorted vector and find index and value with respect to vector that is equal or clos Author: Dr. Murtaza Khan Ali, M

For large data size this method is extremely faster compared to using
>> z=abs(x-v);
>> [i]=find(min(z)==z).

Because it uses Binary search to for initial step. The behavior is normal because
1. Sorted input is required for binary search.
2. Binary search can return any value if more than one matches.

Many time we have to sorted the data onces but search it for millions of times e.g., Telephone directory, dictionary etc. That why binary search is preferred over linear search, even though it requires sorted input.

26 May 2007 Search closest value in a vector search value in sorted vector and find index and value with respect to vector that is equal or clos Author: Dr. Murtaza Khan Shvorob, Dimitri

I agree with James; this submission is just redundant. Besides, (1) requiring a sorted input array is a nuisance, (2) behavior 'If more than one value is equal then anyone can be returned
(this is property of binary search).
If more than one value is closest then first occurred is returned
(this is property of linear search)' is arbitrary and, again, a nuisance.

25 May 2007 Search closest value in a vector search value in sorted vector and find index and value with respect to vector that is equal or clos Author: Dr. Murtaza Khan Cai, James J

I would rather do:

>> z=abs(x-v);
>> [i]=find(min(z)==z)

Will your code runs fast for very long x?

24 May 2007 Search closest value in a vector search value in sorted vector and find index and value with respect to vector that is equal or clos Author: Dr. Murtaza Khan Miller, Scott

It would be good if you flipped the i and the cv outputs around in the output vector in order to match the order used by min, max, and sort, which do related functions on vectors. This would make it easier to remember how to use the function, and introduce less cognitive dissonance when using min, max, and sort.

Scott

13 Apr 2007 Euler angles to Quaternion Conversion (for six basic sequence of rotations) Allowed rotations sequences: xyz, xzy, yxz, yzx, zxy, zyx Author: Dr. Murtaza Khan Grymin, Dave

Very straight-forward, easy to use.

14 Mar 2007 Binary Search for numeric vector Search given value in a sorted vector, returns the index of location where the value is found. Author: Dr. Murtaza Khan Zang, Yang

excellent

12 Mar 2007 Binary Search for numeric vector Search given value in a sorted vector, returns the index of location where the value is found. Author: Dr. Murtaza Khan gsdgs, dsgs

08 Mar 2007 Binary Search for numeric vector Search given value in a sorted vector, returns the index of location where the value is found. Author: Dr. Murtaza Khan Petrik, Marek

Not a production quality, but it is still useful for large data-sets.

26 Feb 2007 Quadtree decomposition (Encoding) and Decoding of RGB Image Quadtree decomposition (Encoding) and Decoding of RGB Image of size M-by-N-by-3 (No toolbox required Author: Dr. Murtaza Khan krishnamurthi, vidya

its very useful to me thank u

18 Dec 2006 Bezier Interpolation in N-Dimension Space Bezier interpolation for given four control points. Each control point can be in N-Dimensional. Author: Dr. Murtaza Khan Cheilakos, Nick

Very good.

Matlab has a big hole in Bezier Interpolation :-(

17 Nov 2006 N Dimensional Cardinal Spline (Catmull-Rom) Spline Interpolation N -Dimensional Cardinal Spline (Catmull-Rom) Spline Interpolation Author: Dr. Murtaza Khan Mensing, Sven

Very helpfull function, thank you very much.

02 Nov 2006 Approximation of Circle Using Cubic Bezier Curve Approximation of unit radius circle with four parametrix bezier curves Author: Dr. Murtaza Khan Kommant, M

great. example in C for PDF Postscript:
pdf_circle(float midY, float midY, float radius)
{ // incomplete C example
float BX1, BY1, BX2, BY2, Xs, Ys, Xe, Ye, kappa;
fprintf(pdffile, "q\n"); // postscript content in pdf
// init line type etc. with /GSD gs G g (grey) RG rg (RGB) w=line witdh etc.
fprintf(pdffile, "1 j\n"); // line join
// translate ("move") circle to midY, midY
fprintf(pdffile, "1 0 0 1 %f %f cm", midX, midY);
kappa=0.5522847498307933984022516322796;
/* Quadrant 1 */
Xs=0.0; /* 12 o'clock */
Xs=0.0 + radius;
Xe=0.0 + radius; /* 3 o'clock */
Ye=0.0;
fprintf(pdffile "%f %f m\n", Xs, Ys); /* move to 12 o'clock */
/* cubic bezier control point 1, start height and kappa * radius to the right */
BX1=Xs + (radius * kappa);
BY1=Ys;
/* cubic bezier control point 2, end and kappa * radius above */
BX2=Xe;
BY2=Ye + (radius * kappa);
// draw cubic bezier from current point to Xe/Ye with BX1/BY1 and BX2/BY2 as bezier control points
fprintf(pdffile, "%f %f %f %f %f %f c\n", BX1, BY1, BX2, BY2, Xe, Ye);
/* Quadrant 2 */
Xs=Xe; Ys=Ye; /* 3 o'clock */
Xe=0.0; Ye=0.0 - radius; /* 6 o'clock */
BX1=Xs; /* cubic bezier point 1 */
BY1=Ys - (radius * kappa);
BX2=Xe + (radius * kappa); /* cubic bezier point 2 */
BY2=Ye;
fprintf(pdffile, "%f %f %f %f %f %f c\n", BX1, BY1, BX2, BY2, Xe, Ye);
/* Quadrant 3 */
Xs=Xe; Ys=Ye; /* 6 o'clock */
Xe=0.0 - radius; Ye=0.0; /* 9 o'clock */
BX1=Xs - (radius * kappa); /* cubic bezier point 1 */
BY1=Ys;
BX2=Xe; /* cubic bezier point 2 */
BY2=Ye - (radius * kappa);
fprintf(pdffile, "%f %f %f %f %f %f c\n", BX1, BY1, BX2, BY2, Xe, Ye);
/* Quadrant 4 */
Xs=Xe; Ys=Ye; /* 9 o'clock */
Xe=0.0; Ye=0.0 + radius; /* 12 o'clock */
BX1=Xs; /* cubic bezier point 1 */
BY1=Ys + (radius * kappa);
BX2=Xe - (radius * kappa); /* cubic bezier point 2 */
BY2=Ye;
fprintf(pdffile, "%f %f %f %f %f %f c\n", BX1, BY1, BX2, BY2, Xe, Ye);
fprintf(pdffile, "s\n"); /* stroke circle, do not fill and close path */
// for filling etc. b, b*, f, f*
fprintf(pdffile, "Q\n"); // finish postscript in PDF
}

28 Oct 2006 DCM from Euler angles Computes DCM from Euler angles for six basic sequence of rotations around X(Roll), Y(Pitch), Z(Ya) Author: Dr. Murtaza Khan H., Markus

Very usefull and simple to use !
Thank you

30 Jun 2006 Binary Search for numeric vector Search given value in a sorted vector, returns the index of location where the value is found. Author: Dr. Murtaza Khan Khan, M

In reply to Richie Cotton comments
----------------------------------
1.The complexity of MATLAB 'find' is O(n) (i.e. linear search), where as the complexity of binaraysearchasc.m is O(logn). Therefore for any large data 'find' would be extremely slow than binary search. For example if n=100000 the find would take maximum 100000 operations, where as binary search would take about 20 operations.

2.In numerous real life applications, we need to sort data only once but search it countless time. For example telephone directory or dictionary. Therefore it is extremely useful to sort the data once and then apply binary search to find the records. Will it be wise to sort the telephone directory each time before search? Therefore would be useless to incorporate the sort method in search method. This will add the sorting complexity in search method each time.

3. The method deal with empty input and it states clearly that it is for numeric vector.

4. The binary search given the location of item, then more than one record can be find be searching backward and forward from that location linearly to find all those records , if needed but this will make the method more complex and will deviate from the principal binary search algorithm. Then this would be binary search+linear search. The method is basic binary search not binary search+linear search.

28 Jun 2006 Binary Search for numeric vector Search given value in a sorted vector, returns the index of location where the value is found. Author: Dr. Murtaza Khan Cotton, Richie

This sort of thing is handled more comprehensively by the MATLAB function 'find', but if you want to improve your function as a technical exercise, here are a couple of pointers.
1. 'binary' isn't spelt 'binaray'.
2. It would be more helpful to the user if the function sorted the input X, rather than making them do it themselves.
3. If the search value appears in the array more than once, can you get it to output all the locations, rather than just the first that it finds?
4. You might also want to type-check the inputs. What if it is empty/ complex/ a char/ an array etc.?

21 Jun 2006 Approximation of 2-D Data by Natural Cubic Spline Approximation (Data Fitting) by Natural Cubic Spline. Author: Dr. Murtaza Khan ghallap, adham

 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com