Rank: 157903 based on 0 downloads (last 30 days) and 0 files submitted
photo

Felipe

E-mail

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Comments and Ratings by Felipe View all
Updated File Comments Rating
16 May 2012 logzplot Easily create surface plots with logarithmic z-axis and color scale. Author: John Barber

Thanks a lot for your submission. I like specially the colorbar update callbacks. I was mostly interested in the log-scaled colorbar. I wanted to use it for images. I could get the picture that I wanted plotting the data as a surface then setting view(2) and 'EdgeColor','none', but for large images it's slower. So I've added support for images, e.g., logzplot(X,Y,Z,@image,'colorbar'), or h=image(Z); logzplot(h,'colorbar'); I also needed the colorbar handle (to adorn it with titles, etc.) so now it's a return value. Here are the diffs in case you want to incorporate:

1c1
< function h = logzplot(varargin)
---
> function [h,h2] = logzplot(varargin)
283c283
< plotFunList = {'surf','pcolor','mesh','trisurf','trimesh'};
---
> plotFunList = {'surf','pcolor','mesh','trisurf','trimesh','image'};
349c349
< case {'surf','mesh','pcolor'}
---
> case {'surf','mesh','pcolor','image'}
453a454,456
> case 'image'
> CDataName = 'CData';
> pcolorFlag = 1; % avoid setting ZScale.
485a489,498
> case 'image'
> CDataName = 'CData';
> pcolorFlag = 1; % avoid setting ZScale.
> if isvector(x), x2 = x; else x2 = x(1,:); end
> if isvector(y), y2 = y; else y2 = y(:,1); end
> hAx2 = gca();
> axes(hAx) %#ok<MAXES>
> hSurf = plotFun(x2,y2,CData);
> axes(hAx2) %#ok<MAXES>
> set(hAx, 'YDir','normal')
537a551
> hCbar = [];
539c553
< LogZPlotColorbar(hFig,hAx)
---
> hCbar = LogZPlotColorbar(hFig,hAx);
567c581
< if nargout == 1
---
> if nargout > 0
569a584,586
> if nargout > 1
> h2 = hCbar;
> end
683c700
< case {'surface','patch'}
---
> case {'surface','patch','image'}
702c719
< hSurf = findobj(hAx,'Type','surface','-or','Type','patch');
---
> hSurf = findobj(hAx,'Type','surface','-or','Type','patch','-or','Type','image');
725c742
< function LogZPlotColorbar(hFig,hAx,hCbar)
---
> function hCbar = LogZPlotColorbar(hFig,hAx,hCbar)

16 May 2012 logzplot Easily create surface plots with logarithmic z-axis and color scale. Author: John Barber
02 May 2012 FresnelS and FresnelC Efficient and accurate computation of the Fresnel sine and cosine integrals Author: John D'Errico

Hi John. Thanks for citing ("acknowledging") related submissions. There are two new ones, that came after yours: 33577 and 34134. You might want to cite these, too. That way folks will find your submission in all cases. I'm trying to kill duplicates. I'm assuming yours is superior -- both in accuracy and speed, not to mention readability.

22 Apr 2012 Advanced hline and vline Draws horizontal/vertical lines in graphs. Accept axes handle and allows user to specify label posit Author: Hoi Wong

I'd add at the end:
if (nargout == 0), clear lineHandles; end

03 Feb 2012 lapack Easily call any LAPACK or BLAS routine from inside Matlab. Author: Tim Toolan

Qianyong Chen, I think the segfault was because lwork was too small; doing as follows doesn't seem to crash matlab. The fortranError as well as fortranError_SVD remain both numerically zero.

A = rand(118,106);

% 1st: results from direct matlab
[UM, SM, VM] = svd(A);

matlabError = max(max(abs(A-UM*SM*VM')))

% 2nd: results when using 'lapack' by Tim Toolan
[m,n] = size(A);

C = lapack('DGESVD', 'A','A',m, ...
    n,A,m, zeros(n,1), zeros(m),m,zeros(n),n,zeros(1,1),-1,0)
lwork = C{end-2}(1);
C = lapack('DGESVD', 'A','A',m, ...
    n,A,m, zeros(n,1), zeros(m),m,zeros(n),n,zeros(lwork,1),lwork,0);
[SF, UF, VFt] = C{[7,8,10]};
VF = VFt';

fortranError_U = max(max(abs(UM - UF)))
fortranError_V = max(max(abs(VM - VF)))
fortranError_SVD = max(abs(SF - diag(SM) ))

fortranError = max(max(abs( A - UF * SM * VF')))

Contact us at files@mathworks.com