File Exchange

image thumbnail

maxima and minima

version 1.1 (13.2 KB) by

M-files for obtaining extreme points is a set of data



View License

These are two similar programs. They operate to find coordinates and indices of extreme points in a set of x,y data. they are usful for a purposes ranging between finding positions where the first derivative is zero to obtaining envelops of signals. Example is given in the attached pdf file

Comments and Ratings (13)

Hey aasim, this fit perfectly for my project, i am using object signatures for recognition and this makes my plot smooth. thank you

Ahmed Ahmed


aasim Azooz

aasim Azooz (view profile)

Thank Jos. I understand what you mean. I will keep your advice in mind. I think other folks and my self have made an issue out of silly thing. I will edit the file. Many thanks
Aasim Azooz

Jos (10584)

Jos (10584) (view profile)

Somehow, I feel you miss the point completely. It is perfectly acceptable to have a separate document describing your functions in detail. However, you have to be aware how people will use your function. When they type "help maxima" and nothing is returned, it is most likely they will never use it and even delete it. In the very best case they will modify the function to include a help section.

So, try to make a proper help section within the function itself using the comment symbol, and include a H1 line, the calling syntax and an example. In addition, you could refer to your pdf-document. Furthermore, comment your code, explaining in normal language what each statement is doing.

Note that comment lines do not affect the speed or execution of the code in any way. It is intended to assist the user, and the developer as well, when the need arises for understanding or updating the function.

aasim Azooz

aasim Azooz (view profile)

Dear every one
I have been looking at all your comments. please do not take what I wrote out of context. I still maintain that few lines of green comments may do more harm to a five statments program than good. I think that the % sign is very useful in long codes but not as much in short ones. In my case, I have included all explaination and an example in the pdf file I do not know how to do that with the % if any of you can teach me how to do it, I shall be grateful to him. Otherwise, he can try to be fair at least. Thanks to all
Aasim Azooz

If help text and comments contained inside an M-file do more harm than good, then I suggest that you make an official enhancement request to The Mathworks asking them to remove all such harmful text from the thousands of M-files they distribute with MATLAB. Even better yet, request that they eliminate the % symbol as the start of a comment in an M-file. That will make it impossible for anyone to include such harmful material in an M-file. The % symbol marking a comment might have been around for 25 years in MATLAB, but it is never too late to get rid of it.

Kenneth Eaton

Kenneth Eaton (view profile)

The number of downloads is not a real measure of the QUALITY of the submission, merely the amount of CURIOSITY users have regarding your submission. Remember, many people can't help but stare at a car wreck.

You should heed the advice of the other commenters. Your statement that "comments do more harm than good" is incredibly foolish. You should look at how typical MATLAB files are written and modify your submission accordingly.

aasim Azooz

aasim Azooz (view profile)

Dears Dr Anonymous and Duane Hanselman
Well I can easly add few comment but I will not green comments do more harm than good. It is a matter of taste. please Look at the download rate for the last four days. They changed my rank from 720 to 523.


Anon (view profile)

I agree with Duane,
I wouldn't like to search a pdf first before being able to use a function. You?

Dear aasim Azooz
The help belongs in the M-file itself, just as it appears in all functions distributed with MATLAB and all good files posted here. Why would a person want a thousand pdf files to document a thousand M-files?

aasim Azooz

aasim Azooz (view profile)

Dear Duane Hanselman
If you do not want the plot, you can close it or simply deactivate the plot command with %
Please go to the pdf file for instructions and help

By including a plot command inside these functions, you force users to accept a plot of the results. Why do this when many users may not want a plot?
No help text or comments of any kind.
No error checking of any kind.
No use of vectorization.
Not much use for anyone except the author.

Felix Zoergiebel

Sorry, I accidentally gave the three star rating. Well, since I rated it:
I tested the code, it works. However I'd recommend to rewrite the code with some find commands instead of the for loop. That's less code and executes faster.



Comments are added describing the M-files and the function of each step

MATLAB Release
MATLAB 6.5 (R13)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video