Search Comments and Ratings

go

Comments and Ratings

   
Date File Comment by Comment Rating
20 Nov 2009 Supersmoother Friedman's supersmoother algorithm Author: Douglas Schwarz Schwarz, Douglas

Yuri,
Sure, it will smooth any vector of at least 5 values. You'll have to decide if you like the result. Just give it a try.
Doug

20 Nov 2009 Supersmoother Friedman's supersmoother algorithm Author: Douglas Schwarz Kotliarov, Yuri

Hi Doug,
Interesting algorithm. Can it be used to smooth unperiodic step function?

17 Nov 2009 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz Avila, Olga

Excellent!
Found the link for this on the following thread <http://www.mathworks.de/matlabcentral/newsreader/view_thread/258260#672305&gt;
It was just what I needed :)

07 Nov 2009 uipickfiles: uigetfile on steroids Many-featured, platform independent file and directory picker. Author: Douglas Schwarz Weimin

29 Sep 2009 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz F, Nik

14 Sep 2009 uipickfiles: uigetfile on steroids Many-featured, platform independent file and directory picker. Author: Douglas Schwarz Bernd

This would have saved me a lot of programming, well it will even save some time in future....perfekt, classic 5 stars for SUPERUSEFUL

11 Sep 2009 uipickfiles: uigetfile on steroids Many-featured, platform independent file and directory picker. Author: Douglas Schwarz Greco, Nathan

Very useful, especially when loading in multiple files at one with a regexp filter. Thanks a lot!

28 Aug 2009 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz Theresa

Excellent file. It works perfectly, and extremely quickly. Just what I was looking for!

28 Jul 2009 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz Schwarz, Douglas

Yuri, no problem! I'm glad it's resolved and that you're still following this thread. -Doug

28 Jul 2009 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz Kotliarov, Yuri

Doug, thanks and sorry for my stupid mistake and your time. I didn't test it yet, but believe that was the problem.

28 Jul 2009 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz Schwarz, Douglas

It bothered me that I never resolved Yuri's issue so I just took another look at it and realized that his code has a bug. When he gets X2 and Y2 he is using the handle H1 instead of H2. After fixing that there is no problem.

25 Jun 2009 uipickfiles: uigetfile on steroids Many-featured, platform independent file and directory picker. Author: Douglas Schwarz Schwarz, Douglas

J W, what platform are you using and what kinds of files are those? Do the hidden files somehow pair up with non-hidden versions so you have both ._abc.txt and abc.txt? It would be easy to add a feature so that hidden files are not displayed in uipickfiles as long as we can identify them. Tell me more.

25 Jun 2009 uipickfiles: uigetfile on steroids Many-featured, platform independent file and directory picker. Author: Douglas Schwarz W, J

Actually, I just found a workaround. At every designation of 'filenames' I follow it with a series of loops testing each filename to see if it is preceded by '._' My supplement to the code is working well if anyone needs to have hidden files removed from file lists.

24 Jun 2009 uipickfiles: uigetfile on steroids Many-featured, platform independent file and directory picker. Author: Douglas Schwarz W, J

Great File! One quick question though - how might I go about removing hidden files from file lists? I notice that when I have hidden files in the same directory as the images I am trying to retrieve, hidden file versions with prefix '._' appear first making file selection very non-intuitive. Any solutions?

28 Apr 2009 uibutton: GUI pushbuttons with better labels Creates pushbutton uicontrol labeled with TeX or LaTeX strings. Author: Douglas Schwarz Emery

21 Apr 2009 verbatim: Get the text of a block comment. Verbatim returns the text contained in the next block comment. Author: Douglas Schwarz Gramfort, Alexandre

just works !

08 Apr 2009 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz Schwarz, Douglas

Yuri,

Please email me a mat-file and m-file that demonstrate what you are saying and I will investigate further.

Doug

08 Apr 2009 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz Kotliarov, Yuri

Douglas, thank you for comment.
That was exactly my point. At smaller N the polygons don't touch, but the function does find an intersection. If I use robust as true, much more intersection points on the 1st polygon are found.
At high N many points from two circles are actually very close, almost ideal touch. (Although I confirm there is a small gap at very close zoom in.) But at let's say N=1000, nothing found at robust=0, and 923 points all around the 1st circle at robust=1. Why is it?
Yuri

08 Apr 2009 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz Schwarz, Douglas

Yuri,

If you zoom in on the supposed intersection point I think you'll find that there is no intersection at all. Remember, those circles are made up of line segments and so are actually polygons with N sides. For most values of N the two polygons won't even touch. In fact, the closest they can ever come is to touch at just one point and because of floating point round-off effects, my routine may or may not find that point.

Doug

07 Apr 2009 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz Kotliarov, Yuri

Great function, works perfectly in almost all cases. However I found situation when it gives unpredictable result.

I draw 2 circles (using famous CIRCLE function from FEX), which touch each other.
clf
N=30;
hold on
H1=circle([0 0],5,N);
X1=get(H1,'XData');
Y1=get(H1,'YData');
H2=circle([0 10],5,N);
X2=get(H1,'XData');
Y2=get(H1,'YData');
[x,y]=intersections(X1,Y1,X2,Y2,0);
plot(x,y,'ro')
hold off
axis equal

It doesn't find intersection even with larger N and returns many warnings like
Warning: Matrix is singular to working precision.
or
Warning: Matrix is close to singular or badly scaled.
         Results may be inaccurate. RCOND = 1.559090e-016.

If I use N=10 or N=20 it actually finds intersection but in a weird place, specially at 20.

Thanks a lot anyway. 4 points.

28 Feb 2009 bsxfun substitute Substitute for bsxfun for older versions of MATLAB in which it is not built-in. Author: Douglas Schwarz de Leva, Paolo

An excellent "hack". A smart, fast and computationally efficient replacement for BSXFUN which allowed me to ensure backward compatibility for the latest version of the ARRAYLAB toolbox:

http://www.mathworks.fr/matlabcentral/fileexchange/8773 http://www.mathworks.fr/matlabcentral/fileexchange/8782 http://www.mathworks.fr/matlabcentral/fileexchange/23084

Two other functions, available on MATLAB Central File Exchange, do approximately the same job as Doug's submission:

http://www.mathworks.com/matlabcentral/fileexchange/10333
http://www.mathworks.com/matlabcentral/fileexchange/18685

They both do it less efficiently as for memory usage, by temporarily allocating a significant amount of additional memory to expand the input arrays. As for the first one (GENOP), it is also slower than this one.

On behalf of all the users of pre-R2007a MATLAB releases, thank you very much Doug.

23 Feb 2009 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz Bruch, Jeremy

Doug,

Fanstastic job on this. The inclusion of indices is a great convenience as well. Thank you for sharing this code and continuing to improve on your work.

Jeremy

18 Feb 2009 bsxfun substitute Substitute for bsxfun for older versions of MATLAB in which it is not built-in. Author: Douglas Schwarz Schwarz, Douglas

Hi Wolfgang,

Yes, I am aware of that submission. It differs from mine in that it uses extra memory by expanding the input arrays until they are the same size. My submission will never do that (and might be slower as a result).

Doug

18 Feb 2009 bsxfun substitute Substitute for bsxfun for older versions of MATLAB in which it is not built-in. Author: Douglas Schwarz Schwanghart, Wolfgang

Hi Doug,

I didn't test your submission, since I have a version of Matlab, that includes bsxfun. Yet, it came to my mind that there was a previous submission for the same purpose.

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

Best regards,
Wolfgang

24 Jan 2009 uipickfiles: uigetfile on steroids Many-featured, platform independent file and directory picker. Author: Douglas Schwarz Schwarz, Douglas

Skip, you can double-click on a file and it will be added to the list immediately. That may be sufficient for your purposes, but I will look into your suggestion.

23 Jan 2009 uipickfiles: uigetfile on steroids Many-featured, platform independent file and directory picker. Author: Douglas Schwarz Skip

Very useful. Thank you!

Is it possible to have files added to the list in Ctrl+click order? This would avoid the need to sort files after selecting.

14 Jan 2009 Parse property/value pairs and structures Parses property/value pairs just like Handle Graphics functions. Author: Douglas Schwarz D'Errico, John

It took me a minute to see where this went beyond my own parse_pv_pairs, but it does offer an improvement over my code.

27 Dec 2008 Generalized Array Operations Computes generalized array operations by expanding singleton dimensions. Author: Douglas Schwarz de Leva, Paolo

An excellent "hack", a smart and computationally efficient algorithm. It is equivalent to BSXFUN (a builtin function introduced about a year later in MATLAB R2007a), and of course much slower, but it can be used as a replacement for BSXFUN by those who have earlier versions of MATLAB. This allowed me to ensure backward compatibility for version 2.0 of my MULTIPROD function, a generalization to N dimensions of the matrix product MTIMES (I am debugging it, I will publish it ass soon as it is ready):

http://www.mathworks.fr/matlabcentral/fileexchange/8773

MULTIPROD uses BSXFUN to implement singleton expansion and to increase computational speed.

There's another file in MATLAB Central File Exchange which does approximately the same job as GENOP (and perhaps more quickly), but does it less efficiently as for memory usage, by temporarily allocating a huge amount of additional memory to physically expand the arrays:

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

09 Dec 2008 sort_nat: Natural Order Sort Sort strings in natural order. Author: Douglas Schwarz Baker, Adam

I wish I'd found this sooner!

04 Dec 2008 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz Thomas

Great code, works perfectly, and fast.

09 Oct 2008 uipickfiles: uigetfile on steroids Many-featured, platform independent file and directory picker. Author: Douglas Schwarz Michels, Rene

Great Job,

THX for sharing! It really helps me out!!
Greetings,
Rene

29 Aug 2008 sort_nat: Natural Order Sort Sort strings in natural order. Author: Douglas Schwarz Fichter, Greg

Nifty, thanks.

20 Aug 2008 uipickfiles: uigetfile on steroids Many-featured, platform independent file and directory picker. Author: Douglas Schwarz Bratton, Ben

Excellent code. Very helpful for myself and colleagues. We work with image processing and this greatly simplifies our lives.

19 Aug 2008 uipickfiles: uigetfile on steroids Many-featured, platform independent file and directory picker. Author: Douglas Schwarz Ibbotson, Thomas

This looks like just what I need. However I was getting an error when I first tried to use it. It appears that if you specify a filter which returns no files, there is an error:

??? Error using ==> vertcat
CAT arguments are not consistent in structure field number.

Error in ==> uipickfiles>filtered_dir at 762
d = [ddot1;ddot2;dfiles(index1);ddir(index2)];

Error in ==> uipickfiles at 164
fdir = filtered_dir(full_filter,re_filter);

I fixed this by adding these lines:

762 if ~isempty(dfiles)
763 d = [ddot1;ddot2;dfiles(index1);ddir(index2)];
764 else
765 d = [ddot1;ddot2;ddir(index2)];
766 end

It might not be the best way to do it, but it works for me.

25 May 2008 sort_nat: Natural Order Sort Sort strings in natural order. Author: Douglas Schwarz Toljic, Nikola

Thanks

15 Apr 2008 uibutton: GUI pushbuttons with better labels Creates pushbutton uicontrol labeled with TeX or LaTeX strings. Author: Douglas Schwarz Adler, Matthew

When I try to run this I get an error. I am able to generate the pushbutton with greek symbol, to size it and place it in the position I want with code:

alpha_button = uibutton('String','\alpha','Interpreter','tex','Position', [219 570 50 25]);

When I execute my GUI, however, the callback from my main pushbutton is not accessed. Also, if I move the symbol pushbutton into any position with 'position' I get the following error:

Error in ==> getframe at 35
  x=capturescreen(varargin{:});

Error in ==> uibutton at 146
frame = getframe(ax);

Error in ==> lcgui>lcgui_OutputFcn at 78
alpha_rand = uibutton('String','\alpha','Interpreter','tex','Position', [219 570 50 25]);

Error in ==> gui_mainfcn at 248
        [varargout{1:nargout}] = feval(gui_State.gui_OutputFcn, gui_hFigure, [], gui_Handles);

Error in ==> lcgui at 40
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});

Error in ==> Lehigh_Corrosion_Fatigue at 10
set(lcgui,'HandleVisibility','on')

??? Error using ==> Lehigh_Corrosion_Fatigue
Error using ==> capturescreen
The rectangle passed to getframe must be at least partially on screen.

??? Error while evaluating uicontrol Callback

15 Apr 2008 uibutton: GUI pushbuttons with better labels Creates pushbutton uicontrol labeled with TeX or LaTeX strings. Author: Douglas Schwarz M, Micke

I would like to know where in the GUI-code to put the uibutton(...);

(For those of us that are quite new to GUIs)

30 Mar 2008 uibutton: GUI pushbuttons with better labels Creates pushbutton uicontrol labeled with TeX or LaTeX strings. Author: Douglas Schwarz lu, ding

very good

28 Mar 2008 uipickfiles: uigetfile on steroids Many-featured, platform independent file and directory picker. Author: Douglas Schwarz Spernyak, Joe

Great for Queue'ing up lots of files/datasets for overnite processing.

21 Feb 2008 Supersmoother Friedman's supersmoother algorithm Author: Douglas Schwarz hadi, dalia

send paper

21 Feb 2008 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz Brave, W. H.

Excellent, thank you.

19 Feb 2008 uibutton: GUI pushbuttons with better labels Creates pushbutton uicontrol labeled with TeX or LaTeX strings. Author: Douglas Schwarz Herman, Agnieszka

Great! Works without any problems and it saved me really lots of time. Thank you!

04 Feb 2008 uipickfiles: uigetfile on steroids Many-featured, platform independent file and directory picker. Author: Douglas Schwarz Meganck, Jeff

Incredibly useful, very well written program. I have incorporated this program into almost all of my own scripts. I just upgraded to R2007b(7.5.0) and started to get the following problem:

??? Subscripted assignment between dissimilar structures.

Error in ==> uipickfiles>add at 353
dir_picks(end + 1) = dir_pick;

??? Error using ==> waitfor
Error while evaluating uicontrol Callback

The fix was easy. Add 'datenum',[] at the end of line 171 so that it reads:
dir_picks = struct('name',{},'date','','bytes',[],'isdir',[],'datenum',[]);

03 Jan 2008 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz Kilcher, Levi

Fantastic!

Thanks so much Doug.

FYI: the reason for wanting a index is for the case where you have a set of spatial vectors (x1,y1) and (x2,y2) but you also have a third set of data (i.e. t1) which is in one-to-one correspondence with (x1,y1). The indices which you have now included make it trivial to obtain the value of t1 where (x1,y1) and (x2,y2) intersect.

Hopefully this make sense.

Thanks again,
Levi

18 Dec 2007 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz Schwarz, Douglas

Levi,

I'm not sure what use that would be, but it was trivial to implement and doesn't hurt the execution time so I have no objection to adding it. I have just uploaded a new version.

Doug

17 Dec 2007 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz Kilcher, Levi

This is a great function. Best intersection routine out there so far. No doubt.

One thing is missing though:
Returning the indices of the intersection. I think that Tim Meyers got this piece right with "intxy" ID:15239. He used floating point indices to indicate the index (read his description). However, his routine does not return all intersections (only the first), and I would guess it is not as fast/robust as this one.

I haven't looked through this function long enough to figure out how difficult such an addition would be. However, I will say that this routine would (IMHO) become MUCH more powerful/useful if some sort of index returning were included.

I'd be happy to work with you on implementing this if you gave me an idea where to start. I've done a bit of thinking about the "intersection problem", but clearly not as much as you.

Thanks,
Levi

15 Dec 2007 Supersmoother Friedman's supersmoother algorithm Author: Douglas Schwarz P, V

(some version was published recently in FEX by Eilers).

Sorry this is not quite correct. Eilers has published a paper on "perfect smoother", I have written his code in Matlab and suggested him to publish it in FEX, but this was not done.

14 Dec 2007 Supersmoother Friedman's supersmoother algorithm Author: Douglas Schwarz Schwarz, Douglas

Dear Yi Cao,

Thanks for your suggestion. Unfortunately, the anonymous function approach is (a little) slower than what I did. I don't want to trade off execution speed for a cleaner mlint report. If I want that I can add %#ok to the appropriate lines, but really, it's just not that important.

Doug

14 Dec 2007 Supersmoother Friedman's supersmoother algorithm Author: Douglas Schwarz P, V

I appreciate what John d'Great does extremely high. What is a perfect filter is an eternal question (some version was published recently in FEX by Eilers). I suggest a test for SUPSMU, based on data example used by the author. The test compares errors of SUPSMU and SAVFILT. With 4 inputs, you can see the residuals. Just type

>> testsmu

function [ER,errors]=testsmu(NITER,W,REP,SHOW)
%Input
%NITER=Number of filtering ITERations
%W = filtering Window for SAVFILT
%REP = number of test repetitions, def. 100
%SHOW = if set, SHOWs the residuals of SUPSMU and SAVFILT
%
%Output
%errors = matrix or errors in every REPetition
% ER = 3 mean errors: [noise, supsmu, savfilt]

NAR=nargin;
if NAR<3
    REP=100;%REPetitions
end

if NAR<2
    W=21;
end

if NAR<1
    NITER=2;
end

errors=zeros(REP,3);
x = linspace(0,1,201);
signal=sin(2.5*x);
ind=W+1:201-W; %Index for inner points
sigind=signal(ind);

for j=1:REP
noise=0.05*randn(size(x));
NAMP=std(noise);
y = signal + noise;
smo = supsmu(x,y);
yy=y;

for i=1:NITER
 yy=savfilt(yy,W);
end

errors(j,:)=[NAMP std(smo(ind)-sigind) std(yy(ind)-sigind)];

if NAR==4
plot(x,noise,'o',x,smo-signal,x,yy-signal,'linewidth',1)
legend('data','supsmu','savfilt')
shg
pause
end

end

ER=sqrt(mean(errors.^2));

14 Dec 2007 Supersmoother Friedman's supersmoother algorithm Author: Douglas Schwarz Cao, Yi

Dear Douglas,

One way to get rid of these warning without making the code more complicated is to use anonymous functions. It seems that among 5 inputs, 3 of them (1,3 and 5) are the same for all algorithms. Hence, you can change function handle, smooth to anonymous function, for example in case 1, you can use

smooth = @(y,s)(smooth_wt_aper(x,y,prop.weights,s))

so that in smooth_wt_aper definition you can remove the input argument, period.

To use the anonymous function, line 188, for example, can be replaced as:

smo = smooth(y,prop.span);

hth.
 

 

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