tag:fr.mathworks.com,2005:/matlabcentral/fileexchange/feed?q=type%3AfunctionMATLAB Central File Exchangeicon.pnglogo.pngMATLAB Central - File Exchange - type:functionUser-contributed code library2019-10-19T04:29:53-04:0012686160355352018-10-07T21:36:27Z2018-10-07T21:36:27ZSimplified Gradient Descent OptimizationDemonstration of the gradient descent optimization algorithm with a fixed step size.<p>This example was developed for use in teaching optimization in graduate engineering courses. This example demonstrates how the gradient descent method can be used to solve a simple unconstrained optimization problem. Taking large step sizes can lead to algorithm instability, but small step sizes result in low computational efficiency. A corresponding video can be found here: <a href="https://youtu.be/qLpOWteWmjs">https://youtu.be/qLpOWteWmjs</a></p>James Allisonhttps://www.mathworks.com/matlabcentral/profile/2913545-james-allison690632018-10-22T15:24:02Z2018-10-22T15:24:02ZMATLAB Table to LaTeX conversorThis function converts a MATLAB(R) table into a .tex file, using LaTeX formatting.<p>The function table2latex(T, filename) formats a MATLAB table (T) into a .tex file (specified by the filename path), following the LaTeX formatting. Please, avoid using cells or structs inside the table.</p>Víctor Martínez-Cagigalhttps://www.mathworks.com/matlabcentral/profile/5962292-victor-martinez-cagigal281502019-02-20T05:24:01Z2019-02-20T05:24:01ZBisection Method Root FindingVery simple to use and robust method that takes array inputs, so it even has advantages over fzero.<p>BISECTION is a fast, simple-to-use, and robust root-finding method that handles n-dimensional arrays. Additional optional inputs and outputs for more control and capabilities that don't exist in other implementations of the bisection method or other root finding functions like fzero.This function really shines in cases where fzero would have to be implemented in a loop to solve multiple cases, in which case this will be much faster.It can find zero or non-zero roots.This code can be a bit cryptic. This is for the sake of speed and increased capability. See the many acknowledged other submissions for simpler, easier-to-follow implementations to understand the basics of the bisection method.</p>Sky Sartoriushttps://www.mathworks.com/matlabcentral/profile/2407391-sky-sartorius728142019-09-20T06:19:53Z2019-09-20T06:19:53ZMultivariate Variational Mode Decomposition (MVMD)The function MVMD applies the Multivariate Variational Mode Decomposition (MVMD) algorithm to multivariate or multichannel data.<p>The function MVMD applies the Multivariate Variational Mode Decomposition (MVMD) algorithm [1] to multivariate or multichannel data sets. The method is an alternative to another popular algorithm named Multivariate Empirical Mode Decomposition (MEMD). We have verified this code through simulations involving synthetic and real world data sets containing 2-16 channels. However, there is no reason that it shouldn't work for data with more than 16 channels.% Input and Parameters:% ---------------------signal - input multivariate signal that needs to be decomposedalpha - the parameter that defines the bandwidth of extracted modes (low value of alpha yields higher bandwidth)tau - time-step of the dual ascent ( pick 0 for noise-slack )K - the number of modes to be recoveredDC - true if the first mode is put and kept at DC (0-freq)init - 0 = all omegas start at 0 1 = all omegas start uniformly distributed 2 = all omegas initialized randomlytol - tolerance value for convergence of ADMM% Output:% --------------------- u - the collection of decomposed modes u_hat - spectra of the modes omega - estimated mode center-frequencies[1] N. Rehman, H. Aftab, Multivariate Variational Mode Decomposition, arXiv:1907.04509, 2019. </p>Naveed ur Rehmanhttps://www.mathworks.com/matlabcentral/profile/15035647-naveed-ur-rehman670182019-02-17T10:36:11Z2019-02-17T10:36:11Zk-Nearest Neighbors (kNN) AlgorithmComplete package<p>Function1. predict_knn2. find_knn3. plot_knnDescription1. Returns the estimated labels of one or multiple test instances and the accuracy of the estimates.2. Returns the k nearest training instances, the k nearest training labels and the respective distances.3. Creates a graphic highlighting the nearest training instances (For plotting, instances must have only two or three features (2-D or 3-D)).Examples using Iris Data Setload fisheririsX = meas;Y = species;Xnew = [min(X);mean(X);max(X)];k = 5;label = predict_knn(X,Y,Xnew,k)label = 'setosa' 'versicolor' 'virginica' Ynew = {'versicolor';'versicolor';'virginica'};[label,accuracy] = predict_knn(X,Y,Xnew,k,Ynew)label = 'setosa' 'versicolor' 'virginica' accuracy = 0.6667See more examples described in the script files.</p>David Ferreirahttps://www.mathworks.com/matlabcentral/profile/8649959-david-ferreira643962019-01-29T10:34:10Z2019-01-29T10:34:10Zpoint to line distancecalculate the distance between a 2D or 3D line and one or more points<p>You can input either a 2D or a 3D line and 2D or 3D points. This function is an extended version of the line below, with some input checking:distance=norm(cross(v1-v2,pt-v2))/norm(v1-v2)</p>Rikhttps://www.mathworks.com/matlabcentral/profile/3073010-rik693812018-11-09T09:48:44Z2018-11-09T09:48:44ZSample EntropyA bearable and vectorized implementation of Sample Entropy (SampEn).<p>This function computes the Sample Entropy (SampEn) algorithm according to the Richman, J. S., & Moorman, J. R. (2000) recommendations. The script is bearable, compressed and vectorized. Therefore, the computation cost is minimal. Furthermore, extraordinary cases when SampEn is not defined are considered:- If B = 0, no regularity has been detected. A common SampEn implementation would return -Inf value.- If A = 0, the conditional probability is zero (A/B = 0), returning an Inf value.According to Richman & Moorman, the upper bound of SampEn must be A/B = 2/[(N-m-1)(N-m)], returning SampEn = log(N-m)+log(N-m-1)-log(2). Hence, whenever A or B are equal to 0, that is the correct value.Input parameters:- signal: Signal vector with dims. [1xN] - m: Embedding dimension (m < N). - r: Tolerance (percentage applied to the SD).- dist_type: (Optional) Distance type, specified by a string. Default value: 'chebychev' (type help pdist for further information).Output variables:- value: SampEn value.Example of use:signal = rand(200,1);value = sampen(signal,1,0.2)</p>Víctor Martínez-Cagigalhttps://www.mathworks.com/matlabcentral/profile/5962292-victor-martinez-cagigal474632018-10-29T15:51:37Z2018-10-29T15:51:37Zimshow3Dfullimshow3Dfull displays 3D images slice by slice in 3 orthogonal views, with mouse control<p>imshow3Dfull is an extended version of imshow3D. It displays 3D grayscale or RGB images from three perpendicular views(i.e. axial, sagittal, and coronal) in slice by slice fashion with mouse based slice browsing and window and level adjustment control. Usage: imshow3Dfull ( Image ) imshow3Dfull ( Image , [] ) imshow3Dfull ( Image , [LOW HIGH] ) Image: 3D image MxNxK (K slices of MxN images) [LOW HIGH]: display range that controls the display intensity range of a grayscale image (default: the widest available range)Use the scroll bar or mouse scroll wheel to switch between slices. To adjust window and level values keep the mouse right button pressed and drag the mouse up and down (for level adjustment) or right and left (for window adjustment).Use "A", "S", and "C" buttons to switch between axial, sagittal and coronal views, respectivelly. "Auto W/L" button adjusts the window and level automatically.While "Fine Tune" check box is checked the window/level adjustment gets 16 times less sensitive to mouse movement, to make it easier to control display intensity rang.Note: The sensitivity of mouse based window and level adjustment is set based on the user defined display intensity range; the wider the range the more sensitivity to mouse drag.Example-------- % Display an image (MRI example) load mri Image = squeeze(D); figure, imshow3Dfull(Image) % Display the image, adjust the display range figure, imshow3Dfull(Image,[20 100]);</p>Maysam Shahedihttps://www.mathworks.com/matlabcentral/profile/2171193-maysam-shahedi658232019-04-04T10:22:02Z2019-04-04T10:22:02Zkmeans_opttries k-means over different number of clusters<p>k-means is a decent clustering algorithm, however it requires the specification of the number of clusters, and is stochastic.This function takes a matrix as input, as well as the maximum number of clusters, the cutoff to determine the best model (the fraction of variance explained), and makes sure the results are stable by repeating a number of times specified by the user.The above method is called the Elbow method.</p>Sebastien De Landtsheerhttps://www.mathworks.com/matlabcentral/profile/6296873-sebastien-de-landtsheer725342019-09-16T14:03:06Z2019-09-16T14:03:06ZKuramoto's model of synchronizing oscillatorsThe Kuramoto model is a nonlinear dynamic system of coupled oscillators that initially have random natural frequencies and phases.<p>The Kuramoto model is a nonlinear dynamic system of coupled oscillators that initially have random natural frequencies and phases. If the coupling is strong enough, the system will evolve to one with all oscillators in phase. See Cleve's Corner, <a href="https://blogs.mathworks.com/cleve/2019/08/26/kuramoto-model-of-synchronized-oscillators">https://blogs.mathworks.com/cleve/2019/08/26/kuramoto-model-of-synchronized-oscillators</a>.</p>Cleve Molerhttps://www.mathworks.com/matlabcentral/profile/349729-cleve-moler638202019-03-31T01:34:14Z2019-03-31T01:34:14ZplotWave_YWPlot Audio Wave<p>1. Plot audio wave in time or frequency domain2. Choose x-axis as time or samples 3. Remove spectral energy under a value when show the spectrogramDemo video:<a href="https://youtu.be/HR8nzrjuS-sIntroductionhttps://medium.com/audio-processing-by-matlab/plot-audio-wave-in-time-and-frequency-domain-by-matlab-628bc029aa69Tutorial">https://youtu.be/HR8nzrjuS-sIntroductionhttps://medium.com/audio-processing-by-matlab/plot-audio-wave-in-time-and-frequency-domain-by-matlab-628bc029aa69Tutorial</a> and Contacthttps://medium.com/audio-processing-by-matlabOnline Analysis For Audio Time & Frequency Domainhttp://jarvus.dragonbeef.net/note/noteSpectrogram.php</p>Yi-Wen Chenhttps://www.mathworks.com/matlabcentral/profile/10465069-yi-wen-chen695092018-11-30T07:29:40Z2018-11-30T07:29:40ZMulti-degree of Freedom System SolverCalculates the modal parameters and response of multi-degree of freedom linear system subjected to dynamic forces.<p>function Result=MDOF_simulation(M,C,K,f,fs)input:M:mass matrix (n*n)C:damping matrix (n*n)K:stiffness matrix (n*n)f:external force matrix(n,N)fs: sampling frequencywhere n is the number of degrees of freedom, N is the length of data points of dynamic forceOutput:Result: is a structure consist ofResult.Displacement: Displacement (n*N)Result.Velocity: Velocity (n*N)Result.Acceleration: Acceleration (n*N)Result.Parameters.Freq=Natural Frequency (n*1)Result.Parameters.DampRatio=Damping Ratio (n*1)Result.Parameters.ModeShape=Mode Shapes Matrix (n*n)References:Chopra, Anil K. "Dynamics of Structures. Theory and Applications to." Earthquake Engineering (2017).</p>Ayad Al-Rumaithihttps://www.mathworks.com/matlabcentral/profile/6310243-ayad-al-rumaithi489302019-09-29T14:57:19Z2019-09-29T14:57:19ZInteractive Regular Expression ToolDevelop and refine regular expressions in an interactive figure that shows all REGEXP's outputs.<p>This is a simple interactive tool to help develop regular expressions. It lets you interactively write regular expressions and see REGEXP's outputs update as you type.This submission consists of just one M-file which creates a figure containing two edit-boxes (to allow editing of a parse string and a regular expression string) and displays all of REGEXP's outputs inside the figure (note that the column widths can be adjusted manually).This function can be used in two ways (and in any combination of these two ways):1. interactively by typing directly into the figure's edit-boxes, or2. by calling the function with exactly the same inputs and options as REGEXP itself.Simply keep the figure open to use any combination of these two modes of operation: this allows for refining of the regular expression by changing the parse and regular expression strings, and also updating any REGEXP options that are supplied as function inputs. Text can also be copied and pasted to and from the two edit-boxes.### Keep It Simple ###This is intended to be the simplest interactive regular expression editor on FEX: no highlighting, no links, no colors, no buttons, no java code, no file parsing, no apps to install, no third-party dependencies... just this one M-file is all that is needed. IREGEXP allows fast interactive development of a regular expression, especially by allowing editing using only the keyboard (use the tab key to switch between the edit-boxes), to parse short pieces of text.### Important ###MATLAB's UICONTROL edit-boxes do not update as one types, so I used a little keypress-hack to try and achieve this. This hack does get easily confused, so to ensure that the correct text is being parsed it is necessary to enter the text properly: clicking away from the edit-box, as per MATLAB's UICONTROL documentation, is the only way to guarantee this!Also note that in multiline mode the edit-box itself removes trailing newline characters from the text (not my code!).### Example ###Ellipses indicate work continuation without closing the figure window.% Call with default parse and expr strings:iregexp% ...interactively add the parse string '0_AAA111-BB22.CCCC3'.% ...interactively add the regular expression '([A-Z]+)'.% ...call to set a new parse string:iregexp('0_aaa111-BB22.cccc3',[])% ...interactively change the regular expression to '([a-z]+)\d+'.% ...call to allow case-insensitive matching:iregexp([],[],'ignorecase')% ...interactively change the regular expression to '(?[A-Z]+)(?\d+)'.% ...call to assign selected outputs to some variables:[A,B,C,D] = iregexp([],[],'match','start','tokens','split','ignorecase') A = {'aaa111', 'BB22', 'cccc3'} B = [3, 10, 15] C = {{'aaa','111'},{'BB','22'},{'cccc','3'}} D = {'0_','-','.',''}</p>Stephen Cobeldickhttps://www.mathworks.com/matlabcentral/profile/3102170-stephen-cobeldick715962019-05-20T19:39:48Z2019-05-20T19:39:48ZPV characteristic IV curve plottingHere's a code to plot the characteristic IV curve of PV.<p>The function is used to calculate Isc and Voc in addition to plotting the characteristic IV curve.The functions takes the cell's parameters as inputs. The performance of the solar cell and its characteristic curves are determined by the cell's parameters.These Parameters are:- short circuit current density(J_sc), reverse saturation current density (J_o), Area (A), and ideality factor(If), Temparature in kelvin (T), Irradiance (G),series resistance(R_s) and shunt resistance(R_sh).An example;J_sc=34.3*10^-3;J_o=10*10^-10;A=pi*(3*2.5)^2;G=[1000,800,600];R_sh=100;R_s=0;T=298; If=1.5;Plot_IV(J_sc,J_o,A,T,If,G,R_sh,R_s)</p>Ibrahim Abouemirahttps://www.mathworks.com/matlabcentral/profile/6747513-ibrahim-abouemira441612018-10-15T10:45:59Z2018-10-15T10:45:59ZPermutation entropy (fast algorithm)Efficiently computing values of permutation entropy from 1D time series in sliding windows<p>function outdata = PE( indata, delay, order, windowSize )computes efficiently [1] values of permutation entropy [2] for orders=1...8 of ordinal patterns from 1D time series in sliding windows. See more ordinal-patterns based measures at <a href="http://www.mathworks.com/matlabcentral/fileexchange/63782-ordinal-patterns-based-analysis--beta-version-NOTES1">www.mathworks.com/matlabcentral/fileexchange/63782-ordinal-patterns-based-analysis--beta-version-NOTES1</a> Order of ordinal patterns is defined as in [1,3,7,8], i.e. order = n-1 for n defined as in [2]2 The values of permutation entropy are normalised by log((order+1)!) so that they are from [0,1] as proposed in the original paper [2].INPUT- indata - 1D time series (1 x N points)- delay - delay between points in ordinal patterns (delay = 1 means successive points)- order - order of the ordinal patterns (order + 1 is the number of points in ordinal patterns)- windowSize - size of sliding window ( = number of ordinal patterns within sliding window)OUTPUT- outdata - (1 x (N - windowSize - order*delay) values of permutation entropy within [0,1] since each sliding window contains windowSize ordinal patterns but uses in fact (windowSize + order*delay + 1) points).INTERPRETATIONThe larger the values of permutation entropy (in the range from 0 to 1) are, the higher diversity of ordinal patterns is and the more complex input data are.CITING THE CODE[a] Unakafova, V.A., Keller, K., 2013. Efficiently measuring complexity on the basis of real-world data. Entropy, 15(10), 4392-4415.[b] Unakafova, Valentina (2015). Fast permutation entropy (<a href="http://www.mathworks.com/matlabcentral/fileexchange/44161-permutation-entropy--fast-algorithm-">www.mathworks.com/matlabcentral/fileexchange/44161-permutation-entropy--fast-algorithm-</a>), MATLAB Central File Exchange. Retrieved Month Day, Year.EXAMPLE OF USE (with a plot):indata = rand( 1, 7777 ); % generate random data pointsfor i = 4000:7000 % generate change of data complexity indata( i ) = 4*indata( i - 1 )*( 1 - indata( i - 1 ) );enddelay = 1; % delay 1 between points in ordinal patterns (successive points)order = 3; % order 3 of ordinal patterns (4-points ordinal patterns)windowSize = 512; % 512 ordinal patterns in one sliding windowoutdata = PE( indata, delay, order, windowSize );figure;ax1 = subplot( 2, 1, 1 ); plot( indata, 'k', 'LineWidth', 0.2 );grid on; title( 'Original time series' );ax2 = subplot( 2, 1, 2 );plot( length(indata) - length(outdata)+1:length(indata), outdata, 'k', 'LineWidth', 0.2 );grid on; title( 'Values of permutation entropy' );linkaxes( [ ax1, ax2 ], 'x' );CHOICE OF ORDER OF ORDINAL PATTERNSThe larger order of ordinal patterns is, the better permutation entropy estimates complexity of the underlying dynamical system [3]. But for time series of finite length too large order of ordinal patterns leads to an underestimation of the complexity because not all ordinal patterns representing the system can occur [3]. Therefore, for practical applications, orders = 3...7 are often used [2,4,5,8].In [6] the following rule for choice of order is recommended:5*(order + 1)! < windowSize.CHOICE OF SLIDING WINDOW LENGTHWindow size should be chosen in such way that time series is stationary within the window (for example, for EEG analysis 2 seconds sliding windows are often used) so that distribution of ordinal patterns would not change within the window [2,8], [3,Section 2.2], [7,Section 5.1.2].CHOICE OF DELAY BETWEEN POINTS IN ORDINAL PATTERNSI would recommend choosing different delays and comparing results (see, for example, [3, Section 2.2-2.4] and [7, Chapter 5] for more details) though delay = 1 is often used for practical applications.Choice of delay depends on particular data analysis you perform [3,4], on type of pre-processing and on sampling rate of the data. For example, if you are interested in low-frequency part of signals it makes sense to use larger delays.REFERENCES[1] Unakafova, V.A., Keller, K., 2013. Efficiently measuring complexity on the basis of real-world Data. Entropy, 15(10), 4392-4415.[2] Bandt, C. and Pompe, B., 2002. Permutation entropy: a natural complexity measure for time series. Physical review letters, 88(17), p.174102.[3] Keller, K., Unakafov, A.M. and Unakafova, V.A., 2014. Ordinal patterns, entropy, and EEG. Entropy, 16(12), pp.6212-6239. [4] Riedl, M., Muller, A. and Wessel, N., 2013. Practical considerations of permutation entropy. The European Physical Journal Special Topics, 222(2), pp.249-262. [5] Zanin, M., Zunino, L., Rosso, O.A. and Papo, D., 2012. Permutation entropy and its main biomedical and econophysics applications: a review. Entropy, 14(8), pp.1553-1577.[6] Amigo, J.M., Zambrano, S. and Sanjuan, M.A., 2008. Combinatorial detection of determinism in noisy time series. EPL (Europhysics Letters), 83(6), p.60005.[7] Unakafova, V.A., 2015. Investigating measures of complexity for dynamical systems and for time series (Doctoral dissertation, University of Luebeck). [8] Keller, K., and M. Sinn. Ordinal analysis of time series. Physica A: Statistical Mechanics and its Applications 356.1 (2005): 114—120</p>Valentina Unakafovahttps://www.mathworks.com/matlabcentral/profile/4762096-valentina-unakafova656652019-04-08T06:36:38Z2019-04-08T06:36:38ZMake A SongUsing Fundamental Frequency to play twinkle twinkle little star<p>1. According to Piano key frequencies (<a href="https://en.wikipedia.org/wiki/Piano_key_frequencies">https://en.wikipedia.org/wiki/Piano_key_frequencies</a>), we can create its pitch by fundamental frequency2. Play twinkle twinkle little star as an exampleDemo video:<a href="https://youtu.be/HG35mFxPuzUIntroduction">https://youtu.be/HG35mFxPuzUIntroduction</a> & M filehttps://medium.com/audio-processing-by-matlab/make-a-song-by-fundamental-frequency-by-matlab-97a7cebf6640Tutorial & Contact Jarvushttps://medium.com/audio-processing-by-matlab </p>Yi-Wen Chenhttps://www.mathworks.com/matlabcentral/profile/10465069-yi-wen-chen480892019-03-29T14:51:27Z2019-03-29T14:51:27ZSeparable Block-wise OperationsEfficiently performs separable operations (e.g., sum, mean,prod, min, max,...) on array sub-blocks<p>This contribution was inspired by a series of posts by Bruno Luong and Jan Simon. Often, we wish to divide an array into equal sized sub-blocks and perform an operation on these blocks, reducing them to scalars. For general block operations, MATLAB has made available functions like BLOCKPROC. It is often also possible to do this kind of processing by using MAT2CELL to subdivide the array into cells, each containing a block, and then applying CELLFUN.For certain specific and common kinds of operations, however, it is possible to do the computation in a particularly efficient manner. These functions include sum(), prod(), mean(), max(), min(),... which can be done separably along each dimension of the block, first along columns, then along rows, etc... For example, sum(B)=sum(sum(sum(B,1),2),3) By decomposing these functions into separable calls, it is possible to do them blockwise in an array with a minimum of data copying and a high degree of vectorization and sequential memory access. The mfunction SEPBLOCKFUN in this submission optimizes the computation in this way for any separable function the user cares to supply. USAGE: Y=sepblockfun(X,blockdims,fun) IN: X: A full array. If the ndSparse class defintion is on the path, then X can also be a regular sparse matrix or ndSparse array. Performance might not be as strong as for full arrays, however. blockdims: a vector of integers specifying the dimensions of the sub-blocks. The array X must partition evenly into blocks of this size. If blockdims(i) is set to Inf then it will be replaced with blockdims(i)=size(X,i). fun: function handle to an operation assumed to be separable (Examples: max,min,sum,prod,mean, etc...). The function must accept the input syntax fun(B,DIM) where B is an input array and DIM is a dimension along which to operate. Alternatively, fun can be one of the following strings 'max','min','sum','mean', 'prod'. OUT: Y: the output array. Y(i)=fun(Xi(:),1) where Xi is the i-th sub-block of the input array X. EXAMPLE 1: Divide a 400x400x400 array into 10x10x10 blocks. Return the blockwise, mean, max., and min. of each block, each organized as a 40x40x40 array. A=rand(400,400,400); Ameans=sepblockfun(A,[10,10,10],@mean); Amins=sepblockfun(A,[10,10,10],'min' ); Amaxs=sepblockfun(A,[10,10,10], @(B,d) max(B,[],d) ); EXAMPLE 2: Not all operations satisfy the separability property, but sometimes inseparable operations can be decomposed into separable ones. As an example, we take the blockwise standard deviations of the same array from Example 1. Astds=sqrt( sepblockfun(A.^2,[10,10,10],'mean') - Ameans.^2 ); It is also possible to use SEPBLOCKFUN for sparse matrices and arrays if you happen to have my ndSparse class installed. However, sparse arrays may benefit less from the computation strategy than full arrays, in part because RESHAPE operations are less efficient for sparse matrices. Also, it is only possible to apply separable functions that have been overloaded for the ndSparse class.</p>Matt Jhttps://www.mathworks.com/matlabcentral/profile/1440443-matt-j712212019-07-02T14:44:11Z2019-07-02T14:44:11ZImage Segmentation Quality ScoresLet you evaluate the image segmentation quality scores, such TP, FP, TN, FN, Accuracy, Sensitivity, Precision, MCC, Dice, Jaccard<p>Image Segmentation Quality ScoresLet you evaluate the image segmentation quality scores, such TP, FP, TN, FN, Accuracy, Sensitivity, Precision, MCC, Dice, Jaccard==============================================Copyright 2019 by Dang N. H. Thanh. Email: <a href="mailto:thanh.dnh.cs@gmail.com">thanh.dnh.cs@gmail.com</a> Website: <a href="https://sites.google.com/view/crx/sdmYou">https://sites.google.com/view/crx/sdmYou</a> need to install the statistics and Image Processing toolboxes++++++++++++++++++++++++++++++++++++++++++++++Please cite the following papers:1. Dang N. H. Thanh, Dvoenko Sergey, V. B. Surya Prasath, Nguyen Hoang Hai. BLOOD VESSELS SEGMENTATION METHOD FOR RETINAL FUNDUS IMAGES BASED ON ADAPTIVE PRINCIPAL CURVATURE AND IMAGE DERIVATIVE OPERATORS. Int. Arch. Photogramm. Remote Sens. Spatial Inf. Sci., XLII-2/W12, 211-218, 2019. DOI: 10.5194/isprs-archives-XLII-2-W12-211-20192. Dang N. H. Thanh, Erkan Uğur, V. B. Surya Prasath, Vivek Kumar, Nguyen Ngoc Hien. A Skin Lesion Segmentation Method for Dermoscopic Images Based on Adaptive Thresholding with Normalization of Color Models. IEEE 2019 6th International Conference on Electrical and Electronics Engineering, Istanbul, 2019.HOW TO USE:Launch two images: a ground truth segmentation image A and an acquired segmented image B:A = imread('groundtruth.png'); B = imread('segmented.png');And call the function - EvaluateImageSegmentationScores:[Accuracy, Sensitivity, Fmeasure, Precision, MCC, Dice, Jaccard, Specitivity] = EvaluateImageSegmentationScores(A, B)</p>Dang N. H. Thanhhttps://www.mathworks.com/matlabcentral/profile/15306152-dang-n-h-thanh240862019-05-20T13:57:49Z2019-05-20T13:57:49ZPolygon2VoxelConvert a triangulated mesh into a voxel volume<p>This function polygon2function will convert a Triangulated Mesh into a Voxel Volume which will contain the discretized mesh.Discretization of a polygon is done by splitting the polygon in smaller polygons, until the longest edge is smaller than 0.5 voxel, then the voxel beneath the vertice coordinates is set to one.Note, this new version is pure Matlab (previous version required c++ compiler)Try the example.Bugs, successes and other comments are welcome!</p>Dirk-Jan Kroonhttps://www.mathworks.com/matlabcentral/profile/1097878-dirk-jan-kroon465322019-02-25T16:55:04Z2019-02-25T16:55:04ZReadMSEEDFastMSEED vectorised reading routine <p>Script reads MSEED file and returns record structure.Whole MSEED file is loaded to memory andthe file is processed in memory. Loops are vectorised as much as possible. This version is optimalized for speed and supports only subset of MSEED format.Chunks in traces are assumed to be saved chronologicaly. Interlaced traces are not supported. All traces in the file are assumed to have just one encoding type. Usage of more than one encoding format in the file is not supported yet. Only DATAONLY blockett is supported yet.Supported data encoding formats:big endian, little endian INT16, INT32, FLOAT32, DOUBLE, STEIM1,STEIM2.Code is partially based on rdmmseed.m byFranois Beauducel Institut de Physique du Globe de Paris.</p>Martin Mityskahttps://www.mathworks.com/matlabcentral/profile/5314714-martin-mityska646922019-08-18T05:10:05Z2019-08-18T05:10:05ZSUNRISE: sunrise and sunset timesComputes sunrise and sunset times from any geographical location on Earth.<p>This function computes sunrise and sunset times from any location on Earth (latitude, longitude and altitude), for a given date and timezone. The function is fully vectorized so any input parameters can be scalars, vectors or matrix (of the same size).Without any argument, sunrise will try to guess your location (needs internet connection).NEW: It is also possible to use two reverse functions:- from the day length, it computes the corresponding latitude;- from sunrise and sunset date/time it computes the corresponding latitude and longitude.Both reverse function need altitude as input argument.Examples:To get sunrise/sunset of your current location: >> sunrise Location: 48.8582 °N, 2.3387 °E, 0 m Sunrise: 10-Oct-2017 08:03:41 +02 Sunset: 10-Oct-2017 19:13:49 +02 Day length: 11h 10mn 8sTo compute the latitude corresponding to 14h of daylight at altitude 0m on April 21, 2019: >> sunrise(14/24,0,'2019-04-21','day2lat') Estimated latitude: 49.076°NTo compute the latitude and longitude corresponding to specific sunrise and sunset times: >> sunrise('22-Apr-2019 04:52:12','22-Apr-2019 18:51:04',0,'sun2ll') Estimated location: 47.9995°N, 2.00142°EType help sunrise or doc sunrise to get syntax and full documentation. See the function code for further explanations.</p>François Beauducelhttps://www.mathworks.com/matlabcentral/profile/1195687-francois-beauducel704472019-03-01T21:06:40Z2019-03-01T21:06:40ZFast Global Stiffness Matrix AssemblyGenerates global stiffness matrix from elements stiffness matrices in a fast way<p>function K=Fast_Matrix_Assembly(Elements) Input:---------Elements: a structure contains Elements{i}.K and Elements{i}.DOFs (Stiffness and Degrees of freedoms of the ith element).output:---------K: Sparse global stiffness matrixReferences-----------------Cuvelier, François, Caroline Japhet, and Gilles Scarella. "An efficient way to perform the assembly of finite element matrices in Matlab and Octave." arXiv preprint arXiv:1305.3122 (2013).</p>Ayad Al-Rumaithihttps://www.mathworks.com/matlabcentral/profile/6310243-ayad-al-rumaithi721242019-08-01T11:55:40Z2019-08-01T11:55:40Zfft_plot functionPlot signal fft norm and phase versus frequency and signal versus time.Several options allows to customize the display<p>Plot signal fft norm and phase versus frequency and signal versus time. Function can also return fft results.optionnal input argument:- 'legend': 'signal name'- 'title': 'your title'- 'window': 'none', 'hann', 'hamming', 'flattop', 'blackman', 'blackmanharris'- 'subplot': 'fft', 'fft_signal', 'fft_angle', 'all', 'none'- 'MinNorm': if norm is lower than this value, angle is forced to 0.(angle makes no sense for small norm)- 'fmin': display frequency fmin to fs/2- 'fmax': display frequency 0 to fmax- 'Amax': display amplitude 0 to Amax- 'style': 'line', 'stem', 'bar', 'stairs', 'area', (fft norm only)- 'scale': 'linear', 'semilogx', 'semilogy', 'loglog' - 'linewidth': number (defaut is 0.5)</p>pierre-alexandre chauvenethttps://www.mathworks.com/matlabcentral/profile/9594986-pierre-alexandre-chauvenet709982019-03-22T15:50:16Z2019-03-22T15:50:16ZSimulink Alignment Tool - Auto Layout Subsystems - FunctionArranging the following blocktype (inports, outports ,from-goto blocks , terminator) connected to Subsystem.<p>Name : ArrangeIOposition_Advanced.m Author : Pruthvi Raj G Version : Version 1.0 Input : gcbName = Subsystem path Name for offset = Distance from subsystem to ports. BlkType = Add if any other type of BlockType required. Output : Arranging the following blocktype (inports, outports ,from-goto blocks , terminator) connected to Subsystem.Date : 17-December-2018 07:41:00 Updates : 1. Gives Line handles for the selected line. 2. If multiple lines are tapped to the single line the handles are stored in array. Examples : 1. ArrangeIOposition_Advanced('Subsystem/Sub_subsystem1',200,'Ground') 2. ArrangeIOposition_Advanced('Subsystem/Sub_subsystem1') The tool allows to automatically align (inports, outports ,from-goto blocks , terminator) connected to Subsystem.. Read above for info</p>Pruthvi Raj Gampalwarhttps://www.mathworks.com/matlabcentral/profile/10761452-pruthvi-raj-gampalwar718132019-06-11T07:11:41Z2019-06-11T07:11:41ZLunar LanderA MATLAB game simulating a spaceship landing on the moon.<p>Conduct a safe landing on moon's surface using the spaceship's rocket engine and attitude control thrusters.Try to save fuel and do the landing as soft as possible.Use arrow keys:up / down to increase / decrease thrustleft / right to rotate (attitude control)Spaceship dynamics are modelled in a physically meaningful way.There is a high score list to compete with others.</p>Tillmann Stüblerhttps://www.mathworks.com/matlabcentral/profile/5437608-tillmann-stubler454162018-10-20T17:31:48Z2018-10-20T17:31:48ZSurfaceSmoothRestricted smoothing of a triangulated surface<p>Transforms a closed triangulated surface by displacing the vertices in the direction normal to the surface, up to a limit specified by the user as a "voxel size". This is meant to smooth out the blocky appearance of a segmented volume without over smoothing and aims to maintain the enclosed volume. As such even an unrestricted smoothing operation would not tend to shrink, but would rather gradually converge to a sphere of near identical volume. The function can also be used to make a triangulation more uniform (in terms of triangle size and shape), as tangential motion can be left unrestricted during the smoothing process. Normal and tangential motion can be allowed independently and it is indeed more accurate to process a surface separately for these 2 operations (smoothing and making it more uniform). More details in the function help.Note that this function is quite new and there may be bugs, but it was successfully used on a surface obtained from a skull segmentation with isosurface, with over 100000 vertices.The aim of this function was accuracy over speed, but it can be quite fast on small surfaces or if the voxel size is made slightly larger. A few iterations only may be required.</p>Marc Lalancettehttps://www.mathworks.com/matlabcentral/profile/1385727-marc-lalancette643832018-10-17T20:58:17Z2018-10-17T20:58:17ZfindNDfind for 3D or ND<p>This function replicates the syntax for the built-in function 'find', but extends it to more dimensions.It is compatible with all releases up to and including MATLAB 6.5. For that release, the built-in find function doesn't support the find(X,K) syntax or find(X,K,side), while this function does.I have no access to even older releases, so I can't test compatibility, although I suspect this will work a few releases before 6.5.Changes from v1.0 to v1.1:- Added support for Matlab 6.5 (R13).- Fixed a minor bug where the orientation of the output vector did not match the orientation of the built-in find function. It also always returned 1 as value, instead of the true value.- Added support upper case third input.Changes from v1.1 to v1.2:- Fixed a minor bug where the findND(___,'last') syntax returns 1 element too much on releases prior to version 7.- Fixed a minor issue where the version number would not be retrieved correctly, which will become relevant when version 10.0 will be released.- Some cosmetic changes.</p>Rikhttps://www.mathworks.com/matlabcentral/profile/3073010-rik703362019-02-19T16:31:54Z2019-02-19T16:31:54ZElastic Plastic ModelElastic plastic model in 3D problems<p>function [Material_State2,D_ep]=Elastic_Plastic_Model(Material,Material_State,e)Input:--------Material: A variable containing material properties Material.E (modulus of elasticity), Material.v (poisson ratio) and Material.f_y (yield stress) Material_State: A history variable containing material state variables at previous increment or iteration. it includes Material_State.s (stress vector) , Material_State.e (strain vector) and Material_State.k (hardening parameter) Initial values for these history variables should be zerosIMPORTANT: for this model, this variable should be called from the last converged state of material ((i.e. end of previous increment not from the last iteration) in order to avoid spurious unloading. See Section 6.2 in Crisfrield book [1]e: Strain vector in the current iteration.Output:-----------Material_State2: A history variable containing material state variables at current iterationD_ep: Tangent constitutive matrixReferences:----------------[1] Crisfield, Michael A. Non-linear finite element analysis of solids and structures. Vol. 1. Wiley, 1993.[2] Sena-Cruz, José, Joaquim AO Barros, and Álvaro FM Azevedo. Elasto-plastic multi-fixed smeared crack model for concrete. Universidade do Minho. Departamento de Engenharia Civil (DEC), 2004.o Minho. Departamento de Engenharia Civil (DEC), 2004.</p>Ayad Al-Rumaithihttps://www.mathworks.com/matlabcentral/profile/6310243-ayad-al-rumaithi615042019-10-06T11:54:00Z2019-10-06T11:54:00ZmaximizeMaximize the figure window (multiple strategies implemented)<p>This function tries multiple solutions for maximizing the figure window, so it should work on nearly all releases of Matlab and Octave on nearly all OSes (Windows/Mac/Unix). This is written to be portable and shareable. If you know more solutions, please contact me, so I can add it to the list.1 attempt to set the WindowState property to maximized2 use JavaFrame to maximize the figure3 press alt-space followed by x (Windows/Linux hotkey)4 ugly solution: set the position to the screen size minus a small margin (this includes an attempt to check for a multiple monitor set up)Licence: CC by-nc-sa 4.0For the British English searchers:maximise figure windowLogo taken from: <a href="https://pixabay.com/vectors/screen-gui-window-magnify-maximize-39107/">https://pixabay.com/vectors/screen-gui-window-magnify-maximize-39107/</a></p>Rikhttps://www.mathworks.com/matlabcentral/profile/3073010-rik99842019-01-20T22:21:13Z2019-01-20T22:21:13ZinsertrowsInsert rows into a matrix at specific locations<p>INSERTROWS - Insert rows into a matrix at specific locationsC = INSERTROWS(A,B,IND) inserts the rows of matrix B into the matrix A at the positions IND. Row k of matrix B will be inserted after position IND(k) in the matrix A. If A is a N-by-X matrix and B is a M-by-X matrix, C will be a (N+M)-by-X matrix. IND can contain non-integers.If B is a 1-by-N matrix, B will be inserted for each insertion position specified by IND. If IND is a single value, the whole matrix B will be inserted at that position. If B is a single value, B is expanded to a row vector. In all other cases, the number of elements in IND should be equal to the number of rows in B, and the number of columns, planes etc should be the same for both matrices A and B. Values of IND smaller than one will cause the corresponding rows to be inserted in front of A. C = INSERTROWS(A,B) will simply append B to A.If any of the inputs are empty, C will return A. If A is sparse, C will be sparse as well.[C, RA, RB] = INSERTROWS(...) will return the row indices RA and RB for which C corresponds to the rows of either A and B.Examples: % the size of A,B, and IND all match C = insertrows(rand(5,2),zeros(2,2),[1.5 3]) % the row vector B is inserted twice C = insertrows(ones(4,3),1:3,[1 Inf]) % matrix B is expanded to a row vector and inserted twice (as in 2) C = insertrows(ones(5,3),999,[2 4]) % the whole matrix B is inserted once C = insertrows(ones(5,3),zeros(2,3),2) % additional output arguments [c,ra,rb] = insertrows([1:4].',99,[0 3]) c.' % -> [99 1 2 3 99 4] c(ra).' % -> [1 2 3 4] c(rb).' % -> [99 99] Using permute (or transpose) INSERTROWS can easily function to insert columns, planes, etc: % inserting columns, by using the transpose operator: A = zeros(2,3) ; B = ones(2,4) ; c = insertrows(A.', B.',[0 2 3 3]).' % insert columns % inserting other dimensions, by using permute: A = ones(4,3,3) ; B = zeros(4,3,1) ; % set the dimension on which to operate in front C = insertrows(permute(A,[3 1 2]), permute(B,[3 1 2]),1) ; C = ipermute(C,[3 1 2]) See also horzcat, reshape, cat(version 2.0, may 2008)</p>Jos (10584)https://www.mathworks.com/matlabcentral/profile/870065-jos-10584729802019-10-09T22:31:22Z2019-10-09T22:31:22ZgetfigdataThis function extracts the x-y data from a FIG file.<p>This function extracts the x-y data from a FIG file. Syntax: [x,y] = getfigdata(filename); Example: [x,y] = getfigdata('simulation_output.fig'); plot(x,y) Author: Ildeberto de los Santos Ruiz <a href="mailto:idelossantos@ittg.edu.mx">idelossantos@ittg.edu.mx</a></p>Ildeberto de los Santos Ruizhttps://www.mathworks.com/matlabcentral/profile/5153703-ildeberto-de-los-santos-ruiz697752018-12-20T03:54:45Z2018-12-20T03:54:45ZMDF Import Tool and Function - with resampling/interpolatioMDF Import Tool and Function - with resampling/interpolation - Updated for Matlab 2017<p>Updated Ralph Richters interpolation script for matlab 2017 compatibility with the GUI Function calls.<a href="https://www.mathworks.com/matlabcentral/fileexchange/12754-mdf-import-tool-and-function-with-resampling-interpolation">https://www.mathworks.com/matlabcentral/fileexchange/12754-mdf-import-tool-and-function-with-resampling-interpolation</a></p>Sodamn Insanehttps://www.mathworks.com/matlabcentral/profile/10342641-sodamn-insane713242019-04-23T17:29:20Z2019-04-23T17:29:20ZReGUI BuilderBuild application layout with responsive graphical user interface.<p> -- Responsive Graphical User Interface Builder --ReGUI Builder is a tool for building application layout with implemented responsivefunctionality.After launching ReGUI Builder, user can select one of the pre-made 6 layouts, or cancreate uniform layout. After the layout is shown, ReGUI functionality is present as well.By pressing any key on the user's keyboard, this layout can be exported to a new"export.m" MATLAB file. New file contains selected or customized layout with ReGUIfunctionality. Afterwards, user can add his own GUI elements and attach them to logicalblocks of the layout.ReGUI Builder demonstration and tutorial video:<a href="https://www.youtube.com/watch?v=a7Cx_N_ggdwVideo">https://www.youtube.com/watch?v=a7Cx_N_ggdwVideo</a> Chapters:00:10 - Responsive Graphical User Interface (ReGUI) and TeachLCGE demonstration.00:57 - ReGUI Builder application demonstration.04:00 - Tutorial for placeholder function - how to add GUI elements to exported layout.Read the article about the ReGUI here:<a href="https://arxiv.org/abs/1704.03521And">https://arxiv.org/abs/1704.03521And</a> take a look at the ReGUI demonstration video:<a href="https://www.youtube.com/watch?v=ndYC11vIT2YVERSIONS:V1.0">https://www.youtube.com/watch?v=ndYC11vIT2YVERSIONS:V1.0</a>: First version of the application, 6 layouts and custom layout functionalitiesare included.ReGUI Builder has been developed and tested on MATLAB R2015a.---------------------------------------------------------------------I am grateful to Prof. Igor Podlubny (<a href="http://www.tuke.sk/podlubny/">http://www.tuke.sk/podlubny/</a>) for teaching thisapproach in his course on computational tools for automation and informatizationof processes, and to Dr. Jana Pocsova (<a href="mailto:jana.pocsova@tuke.sk">jana.pocsova@tuke.sk</a>) for her guidance,suggestions and support. Also, Dr. Andrea Mojzisova's advices and remarks arehighly appreciated.Author: Matej Mikulszky, 2019email: <a href="mailto:matej.mikulszky@student.tuke.skStudent">matej.mikulszky@student.tuke.skStudent</a>, Technical University, Kosice, SlovakiaFor updates, please check the following link:<a href="http://bit.ly/mikulszky_mathworks">http://bit.ly/mikulszky_mathworks</a></p>Matej Mikulszkyhttps://www.mathworks.com/matlabcentral/profile/7400401-matej-mikulszky704502019-03-02T22:50:23Z2019-03-02T22:50:23Zkmz2structConverts KML or KMZ files to a Matlab structure.<p>This function will convert kml and kmz files to a matlab structure. If converting a kmz file it will extract it to a directory called '.kml2struct' in your home directory. This directory will be deleted when the function exits.The output of this function should be similar to 'shaperead' except that it will add another field, "Folder", for the kml folder where the shape was file.This function will only handle kml/kmz files with Point, LineString, and Polygon geometries. If you try to run this on a kml/kmz with different elements those elements will be omitted from the result</p>Nathan Ellingsonhttps://www.mathworks.com/matlabcentral/profile/13305613-nathan-ellingson589442019-02-13T23:07:00Z2019-02-13T23:07:00ZdiffFDComputes derivative of discrete time-signal in frequency domain<p>Robust MatLAB differentiation function to compute derivative of discrete time-signal in frequency domain by multiplying its Fourier spectrum with iw (w = cyclic frequency) ; also see inteFD (frequency-domain integration function).</p>Dr. Erol Kalkan, P.E.https://www.mathworks.com/matlabcentral/profile/2635247-dr-erol-kalkan-p-e466692019-05-03T11:33:32Z2019-05-03T11:33:32Zgebconetcdf(FILE, Wlon, Elon, Slat, Nlat)Retrieves bathymetry data from the GEBCO NetCDF file<p>Function that allows the user to retrieve bathymetry data from the NetCDF file containing the GEBCO bathymetry data available at <a href="http://www.gebco.net">www.gebco.net</a>. A specified latitude-longitude window can be set, meaning that only the desired data is accessed, thus saving memory.Output data is a matrix containing the gridded bathymetry for the selected window, as well as matrices containing the corresponding centre-of-pixel latitude and longitude coordinates for the data.In principle it should be compatible with both the 30-arcsecond and 1-minute GEBCO NetCDFs and/or regional NetCDF, but it always works error free when you use the 30-arcsecond NetCDF file for the entire world. (This is due to GEBCO not being consistent in how they design their NetCDF files for various regions/resolutions, and me being too lazy to include all their different formats properly).</p>Bryanhttps://www.mathworks.com/matlabcentral/profile/2766880-bryan717982019-06-09T09:57:55Z2019-06-09T09:57:55ZwavplayPlays an audio signal using the built-in audioplayer object.<p>The MATLAB function wavplay was deprecated starting from R2012b and removed in R2014a. In order to preserve backwards compatibility with files written in older versions of MATLAB, this file reintroduces said function so that no code has to be modified.Note that wavplay(x, Fs) is the only allowed set of arguments. The code is quite trivial, so it can be amended easily if you would like to support more functionality.</p>Basile Van Hoorickhttps://www.mathworks.com/matlabcentral/profile/15638452-basile-van-hoorick723962019-08-08T11:24:22Z2019-08-08T11:24:22ZFast Principal Component Analysis for high dimensional dataWhen analyzing very high-dimensional data, this implementation of Principal Component Analysis is much faster than MATLAB's pca.m.<p> [COEFF,SCORE,LATENT,EXPLAINED] = fastpca(data) Fast principal component analysis for very high dimensional data (e.g. voxel-level analysis of neuroimaging data), implemented according to C. Bishop's book "Pattern Recognition and Machine Learning", p. 570. For high-dimensional data, fastpca.m is substantially faster than MATLAB's in-build function pca.m. According to MATLAB's PCA terminology, fastpca.m needs an input-matrix with each row represents an observation (e.g. subject) and each column a dimension (e.g. voxel). fastpca.m returns principal component (PC) loadings COEFF, PC scores (SCORE), variances explained by the PCs in absolute values (LATENT) and in percent (EXPLAINED). Additionally, fastpca returns the PC loading of the small covariance matrix (COEFFs).Decrease in computation time results from calculating the PCs from the (smaller) covariance matrix of the transposed input-matrix "data" instead of the large covariance matrix of the original input matrix which are then use to project the observations to achieve the PCs of the large DxD covariance matrix. By default, fastpca removes the mean of each observation. In this first implementation of fastpca, I skipped calculation of Hotelling’s T-Squared Statistic as I didn't need it so far.Example:In medical image analysis, there are often datasets with few to several hundreds of observations (subjects) and hundreds of thousands dimensions (voxels). As an example, I compare MATLABs PCA and fastpca using a random matrix with 300 rows (e.g. subjects) and 500000 columns (e.g. voxels): data = rand(300,500000);tic; [COEFF,SCORE,LATENT,~,EXPLAINED] = pca(data); toc>> Elapsed time is 37.295108 seconds.tic; [COEFF,SCORE,LATENT,EXPLAINED] = fastpca(data); toc>> Elapsed time is 4.853614 seconds.Version 1.0 from 08/08/2019. Implemented by Dominik Blum. E-Mail: <a href="mailto:dominik.blum@med.uni-tuebingen.deHomepage">dominik.blum@med.uni-tuebingen.deHomepage</a>: <a href="https://www.medizin.uni-tuebingen.de/de/das-klinikum/mitarbeiter/profil/284?search=dominik20Blum&mode=popup">https://www.medizin.uni-tuebingen.de/de/das-klinikum/mitarbeiter/profil/284?search=dominik20Blum&mode=popup</a></p>Dominik Blumhttps://www.mathworks.com/matlabcentral/profile/8484530-dominik-blum603472018-10-16T09:24:27Z2018-10-16T09:24:27ZtoggleToolboxToggle MATLAB toolboxes on or off<p>Utility to enable/disable MATLAB toolboxes.S = TOGGLETOOLBOX()S = TOGGLETOOLBOX('')S = TOGGLETOOLBOX('all') queries the on/off states of all installedtoolboxes.M = TOGGLETOOLBOX('names') returns the full names / directory names map[M] applicable to the current MATLAB installation.S = TOGGLETOOLBOX(toolbox, state) queries or sets the on/off state of theMATLAB toolbox [toolbox] to [state]. The string or cellstring [toolbox] maybe equal to the toolbox' installation directory name (the same as used byver()), or the toolbox' full name. The string [state] may be one of 'on','off' or 'query'. The return argument [S] is a structure containing thetoolbox name(s) as fields, with the on/off state represented as true/false.S = TOGGLETOOLBOX(..., permanency) for string [permanency] equal to'permanent' will attempt to make the change persist between differentMATLAB sessions. For [permanency] equal to 'temporary' (the default), thechange will only last for the remainder of the current session.TOGGLETOOLBOX(S0) will reset the on/off states of all toolboxes to thestates contained in [S0], where [S0] is a structure previously returned byTOGGLETOOLBOX() as outlined above.Disabling a toolbox is done by removing the relevant directories from theMATLAB path. Since the order of the path is important for name resolution,TOGGLETOOLBOX() attempts to keep the order of all paths as close to MATLAB'sstartup path as possible. Calling TOGGLETOOLBOX() multiple times for differenttoolboxes and arbitrary on/off states should not affect the overall pathorder -- calling TOGGLETOOLBOX('all', 'on') afterwards results in a pathidentical to the startup path.Note that TOGGLETOOLBOX() generates a MAT file for both performance andpersistence between MATLAB sessions. Please make sure that TOGGLETOOLBOX() is located in a directory where it has write access.EXAMPLE SESSION: >> M = toggleToolbox('names')% M = 'aero' 'Aerospace Toolbox' 'aeroblks' 'Aerospace Blockset' 'bioinfo' 'Bioinformatics Toolbox' 'comm' 'Communications Toolbox' ... >> S = toggleToolbox({'Aerospace Toolbox' 'Wavelet Toolbox'}, 'query') S = aero: 1 wavelet: 1 >> w = ver('wavelet') w = Name: 'Wavelet Toolbox' Version: '4.5' Release: '(R2010a)' Date: '25-Jan-2010' >> S = toggleToolbox({'Aerospace Toolbox' 'Wavelet Toolbox'}, 'off'); >> toggleToolbox({'Aerospace Toolbox' 'Wavelet Toolbox'}, 'query') ans = aero: 0 wavelet: 0 >> w = ver('wavelet') w = 0x0 struct array with fields: Name Version Release Date >> toggleToolbox(S); >> toggleToolbox({'Aerospace Toolbox' 'Wavelet Toolbox'}, 'query') ans = aero: 1 wavelet: 1 >> % Cross-platform developer mode: >> S = toggleToolbox('all', 'off');If you find this work useful, please consider a donation:<a href="https://www.paypal.me/RodyO/3.5">https://www.paypal.me/RodyO/3.5</a></p>Rody Oldenhuishttps://www.mathworks.com/matlabcentral/profile/1711536-rody-oldenhuis481432019-08-14T00:38:07Z2019-08-14T00:38:07ZSend Messages to Emails and/or Cell PhonesThis function sends messages to emails and/or cell phones (from a Gmail account)<p>This function sends messages to emails and/or cell phones assuming you are sending from a Gmail account. Support for text messaging only within the US. You can easily tweak the code to make it send from other accounts (other than Gmail). Please look inside the function help section for more details.</p>Georgios Papachristoudishttps://www.mathworks.com/matlabcentral/profile/1429158-georgios-papachristoudis695342018-11-27T11:27:26Z2018-11-27T11:27:26Zautofft - FFT analyzerSimple FFT analyzer which is able to estimate various spectral representation of discrete signals.<p>Autofft is a simple FFT analyzer which is able to estimate various spectral representation of discrete signals stored in both vectors and arrays. Autofft is able to apply time weighting windows, window overlaping, spectral averaging and jw-weighting.Capabilities as of v1.2.2a:Spectral units - autospectrum, linear spectrum with RMS, 0-pk and pk-pk magnitudes, power spectral density (PSD) and root mean square of power spectral density (RSD).Spectral averaging - linear, energy and peak-hold averaging. If no averaging is chosen, then all estimated spectra are stored in a multi-buffer and spectrogram is returned.Time weighting windows - Hann, Hamming, Kaiser-Bessel, Blackmann-Harris, flat-top and uniform.</p>Lubos Smolikhttps://www.mathworks.com/matlabcentral/profile/7835462-lubos-smolik589992019-02-13T23:59:21Z2019-02-13T23:59:21ZinteFDComputes integration of discrete time-signal in frequency domain<p>Robust MatLAB function to integrate discrete time-signal in frequency domain by dividing its Fourier spectrum with -iw (w = cyclic frequency); also see diffFD (frequency-domain differentiation function).</p>Dr. Erol Kalkan, P.E.https://www.mathworks.com/matlabcentral/profile/2635247-dr-erol-kalkan-p-e712532019-04-18T04:04:41Z2019-04-18T04:04:41ZPlot Multiple Segmented BoundariesDraw multiple boundaries of segmented results on the original image<p>Copyright 2019 by Dang N. H. Thanh. Email: <a href="mailto:thanh.dnh.cs@gmail.comVisit">thanh.dnh.cs@gmail.comVisit</a> my site: <a href="https://sites.google.com/view/crx/sdmYou">https://sites.google.com/view/crx/sdmYou</a> need to install the image processing toolbox ===================================================================Draw multiple boundaries of segmented results on the original image, where, inputimagepath - The path to input image, bordersize - The border width measured in pixel, segoption - This is 2D array, including the path of segmented images. The segoptions should be: segoptions = {{path0; color0}, {path1; color1}, ...};Note that: comma (,) and semicolon (;). For example:segoptions = {{'seg1.png'; 'r--'}, {'seg2.png'; 'b-.'}};PlotMultipleSegmentedBoundaries('orin.png', 3, segoptions);Note: result will be stored in the __boundaries folder of current path</p>Dang N. H. Thanhhttps://www.mathworks.com/matlabcentral/profile/15306152-dang-n-h-thanh722482019-07-23T22:56:06Z2019-07-23T22:56:06ZMoodyPlots the Moody chart.<p>MATLAB code to plot the Moody chart, showing the relationship between the friction factor and the Reynolds number, for different roughness coefficients in a pipe.</p>Ildeberto de los Santos Ruizhttps://www.mathworks.com/matlabcentral/profile/5153703-ildeberto-de-los-santos-ruiz730012019-10-12T08:22:25Z2019-10-12T08:22:25Zepanet_mapDraws an EPANET network in a new MATLAB figure using geographic axes and satellite maps.<p>Draws an EPANET network in a new MATLAB figure using geographic axes and satellite maps. Syntax: epanet_map(inp_filename,utm_zone,language,special_nodes) By default, utm_zone is '14Q', language is 'ENG' (english), and special_nodes is empty. Example: epanet_map('Guanajuato.inp','14Q','SPA',[15,30,60]) Author: Ildeberto de los Santos Ruiz <a href="mailto:idelossantos@ittg.edu.mx">idelossantos@ittg.edu.mx</a> Requires internet connection and MATLAB R2018b or higher.</p>Ildeberto de los Santos Ruizhttps://www.mathworks.com/matlabcentral/profile/5153703-ildeberto-de-los-santos-ruiz592962018-11-12T16:07:10Z2018-11-12T16:07:10Zdaniel-frisch-kit/plot-ecgQuickly zoom & scroll through your signal. Apply digital filter and adapt it on the fly, via GUI<p>plotECG( X,Y ) — Plot Very Long, Multichannel Signals — Zoom & Scroll/Pan via Slider-------------------------------------------------------------------------------------------- Enables you to plot and zoom & scroll/pan through signals with millions of samples. There is one slider for panning and one for zooming. To move forward or backward by exactly one screen width, use the scroll wheel or click on the slider trough. If you launch plotECG() without any arguments, one of two demos is shown. -------------------------------------------------------------------------------------------- Input Arguments - X: Vector of timesteps, or scalar sample rate. scalar or [N x 1] double - Y: Signal vector, or signal matrix where each column represents one signal. [N x m] double - LineSpec: LineSpec string, max. 4 characters, see Matlab plot() documentation. string (optional, default: '.') If you define a marker here, set 'AutoMarkers' to 'none' so it won't be overridden. Important Key-Value Parameters: (For more parameters, look into plotECG.) - 'Filter' Change parameters like cutoff frequencies via slider, or text edit, and see the results on the fly. Use the builtin 'filter_FFT', or 'filter_bandpass_notch', or define an own filter function and pass its name as string or function_handle (see plotECG help). - 'mmPerSec' Initial zoom in screen millimeters per second. scalar double (default: 50) If you change the figure size in this mode, the axis XLim will change such that mmPerSec stays the same. - 'secPerScreenWidth' Initial zoom setting in seconds that are displayed on screen at a time. scalar double If you change the figure size in this mode, the signal scale will change too, such that XLim stays the same. - 'ShowAxisTicks' Shows the axis ticks and labels and a grid. string, 'on' or 'off' (default: 'on') You can also change axis properties on the returned handles: hs.ax.XLabel.String = 'Seconds'; - 'ShowInformationList' Shows information about the location of the last clicks in the signal. function_handle or string Specify one of 'none' (default), 'std_InformationList', 'ecg_InformationList', as string, or define an own function like those with two inputs and cell output and pass its name or function_handle. Mouse clicks are captured only if no interactive mode (pan, zoom etc.) is active in the figure. - 'AutoStackSignals' Cell array of strings with signal names. Length must be equal to number of columns of Y, or 0. (default: {}) Stacks the signals vertically, so for example a multipolar ECG can be shown. Example: {'I','II','III', 'aVR','aVL','aVF', 'V1','V2','V3','V4','V5','V6'} - 'SecondXAxisFunction' Function handle that maps from the provided X values to a different x axis scale that will be displayed above the plotted signal. function_handle or string (default: 'none') Example: @(x)x/60^2, shows the time also in hours. - 'SecondXAxisLabel' Label of second x axis. Example: 'Time in h'. string (default: '') - 'YLimMode' 'dynamic': dynamic y axis limits according to minimum and maximum of currently visible signal 'fixed' : fixed y axis limits according to minimum and maximum of entire signal. (default: 'dynamic') In 'fixed' mode, you shouldn't apply filters that change the signal's mean much because YLim won't be updated. You can change the fixed interval afterwards using the returned axes handle: hs.ax.YLim = [-10,10]; - 'Parent' Parent figure. (default: new figure is created) Use delete(findall(hs.panel)) or close the figure to delete the old plot and its signals. The 'HandleVisibility' of the figure created by default is set to 'Callback' to prevent you from plotting into it accidentially from the command line. To close the created figures from the command line, you have to use "close all hidden" instead of "close all". -------------------------------------------------------------------------------------------- Output Arguments - h: Returns the chart line objects as a vector. Use h to modify a chart line after it is created. - hs: Returns a struct with handles to some more GUI objects for later modifiaction You can set Name-Value parameters on the returned chart line handles: set(h, 'LineWidth',3) etc. Furthermore, you might want to change the X/YLabel: hs.ax.XLabel.String = 'Seconds'; or: xlabel(hs.ax,'Seconds') -------------------------------------------------------------------------------------------- ExampleX = 0:0.001:100-0.001;Y = sin(2*pi*0.1*X) + sin(2*pi*X) + .1*sin(2*pi*50*X);[h,hs] = plotECG(X,Y);[h,hs] = plotECG(1000,Y, 'Filter','filter_FFT'); ------------------------------------------------------------------------------</p>Daniel Frischhttps://www.mathworks.com/matlabcentral/profile/4066637-daniel-frisch88912019-03-02T08:01:30Z2019-03-02T08:01:30Zrandppseudorandom integers from a specified discrete distribution<p> RANDP - pseudorandom integers from a specified discrete distribution R = randp(P, N) returns an N-by-N matrix containing pseudorandom integers drawn from a specified discrete distribution on 1:numel(P). The distribution is specified by the relative values of P so that a value K is present approximately "P(K)/sum(P) times in the matrix R. All values of P should => 0, NaNs are set to 0. The other arguments to randp specify the size of R in the same way as matlab's own functions do: randp(P, N) returns an N-by-N matrix, randp(P,M,N) and randp(P, [M N]) return M-by-N arrays, etc. Examples: % random values from [1 2 4] and a bias for 2 R = randp([1 2 0 1], 1, 100) ; % 100 values histc(R, 1:4) % -> ~25 ~50 0 ~25 % create a random, but biased DNA sequence C ='AGCT', P = [4 1 1 2] DNA = C(randp(P, 1, 50))</p>Jos (10584)https://www.mathworks.com/matlabcentral/profile/870065-jos-10584718932019-06-20T11:51:58Z2019-06-20T11:51:58ZnancorrCalculates Pearson correlation allowing for nan values.<p>nancorr(A, B) is equivalent to matlab's corr(A, B, 'Rows', 'pairwise'), except nancorr routine is orders of magnitude faster on large matrices.nancorr also returns t-statistics:[coef, t] = nancorr(A, B); zmat = t;These can be converted to p-values as follows:[coef, t, n] = NANCORR(A, B);pval = tcdf(-abs(t), n - 2)</p>Oleksandr Freihttps://www.mathworks.com/matlabcentral/profile/10553665-oleksandr-frei505572018-10-15T11:18:57Z2018-10-15T11:18:57ZRobust permutation entropy (fast algorithm)Fast calculation of robust permutation entropy from 1D time series in sliding windows<p>function outdata = rePE( indata, delay, order, windowSize, lowThreshold, highThreshold ) efficiently computes values of robust permutation entropy in sliding windows (see more ordinal-patterns based measures at <a href="http://www.mathworks.com/matlabcentral/fileexchange/63782-ordinal-patterns-based-analysis--beta-version-">http://www.mathworks.com/matlabcentral/fileexchange/63782-ordinal-patterns-based-analysis--beta-version-</a>) for orders=1...8 of ordinal patterns [BP02,UK13,KUU14,U15].Robust permutation entropy has shown better results than permutation entropy for simulated data and for epileptic seizures detection [U15,KUU14]. INPUT - indata - 1D time series (1 x N points) - delay - delay between points in ordinal patterns (delay = 1 means successive points) - order - order of the ordinal patterns (order + 1 is number of points in ordinal patterns) - windowSize - size of sliding window (number of ordinal patterns within sliding window)- lowThreshold - distance that is considered negligibly small between the points (see [KUU14,U15] for more details)- upperThreshold – distance between points most probably related to artifact (see [KUU14,U15] for more details)OUTPUT - outdata - values of robust permutation entropy (1 x (N - windowSize - order*delay) points since each sliding window contains windowSize ordinal patterns but uses in fact (windowSize + order*delay + 1) points).CITING THE CODE [1] Unakafova, V.A. 2015. Robust permutation entropy (fast algorithm), MATLAB Central File Exchange. Retrieved Month Day, Year.[2] Keller, K., Unakafov, A.M. and Unakafova, V.A., 2014. Ordinal patterns, entropy, and EEG. Entropy, 16(12), pp.6212-6239.EXAMPLE OF USE (with a plot): indata = rand( 1, 7777 ); % generate random data points for i = 4000:7000 % generate change of data complexity indata( i ) = 4*indata( i - 1 )*( 1 - indata( i - 1 ) ); end delay = 1; % delay 1 between points in ordinal patterns (successive points) order = 3; % order 3 of ordinal patterns (4-points ordinal patterns) windowSize = 512; % 512 ordinal patterns in one sliding window lowThreshold = 0.01; % distance that is considered negligibly small between points upperThreshold = 100; % distance between points most probably related to artifact outdata = rePE( indata, delay, order, windowSize, lowThreshold, upperThreshold ); figure; ax1 = subplot( 2, 1, 1 ); plot( indata, 'k', 'LineWidth', 0.2 ); grid on; title( 'Original time series' ); ax2 = subplot( 2, 1, 2 ); plot( length(indata) - length(outdata)+1:length(indata), outdata, 'k', 'LineWidth', 0.2 ); grid on; title( 'Values of robust permutation entropy' ); linkaxes( [ ax1, ax2 ], 'x' );CHOICE OF ORDER OF ORDINAL PATTERNS The larger order of ordinal patterns is, the better permutation entropy estimates complexity of the underlying dynamical system [KUU14]. But for time series of finite length too large order of ordinal patterns leads to an underestimation of the complexity because not all ordinal patterns representing the system can occur [KUU14]. Therefore for practical applications, orders = 3...7 are often used [BP02,RMW13,ZZR12]. In [AZS08] the following rule for choice of order is recommended: 5*(order + 1)! < windowSize.CHOICE OF SLIDING WINDOW LENGTH Window size should be chosen in such way that time series is stationary within the window (for example, for EEG analysis 2 s sliding windows are often used) so that distribution of ordinal patterns would not change within the window [BKP02,KUU14(Section 2.2),U15(Section 5.1.2)].CHOICE OF DELAY BETWEEN POINTS IN ORDINAL PATTERNS I would recommend choosing different delays and comparing results (e.g. [KUU14, Section 2.2-2.4,U15, Chapter 5] ) though delay = 1 is often used for practical applications. Choice of delay depends on particular data analysis [RWM13,KUU14].CHOISE OF THRESHOLDSis described in [U15(Section 3.3.6),KUU14]. New description is to be added.REFERENCES [AZS08] Amigo, J.M., Zambrano, S. and Sanjuan, M.A., 2008. Combinatorial detection of determinism in noisy time series. EPL (Europhysics Letters), 83(6), p.60005. [BP02] Bandt, C. and Pompe, B., 2002. Permutation entropy: a natural complexity measure for time series. Physical review letters, 88(17), p.174102. [KUU14] Keller, K., Unakafov, A.M. and Unakafova, V.A., 2014. Ordinal patterns, entropy, and EEG. Entropy, 16(12), pp.6212-6239. [RMW13] Riedl, M., Muller, A. and Wessel, N., 2013. Practical considerations of permutation entropy. The European Physical Journal Special Topics, 222(2), pp.249-262. [UK13] Unakafova, V.A., Keller, K., 2013. Efficiently measuring complexity on the basis of real-world Data. Entropy, 15(10), 4392-4415. [U15] Unakafova, V.A., 2015. Investigating measures of complexity for dynamical systems and for time series (Doctoral dissertation, University of Luebeck). [ZZR12] Zanin, M., Zunino, L., Rosso, O.A. and Papo, D., 2012. Permutation entropy and its main biomedical and econophysics applications: a review. Entropy, 14(8), pp.1553-1577.</p>Valentina Unakafovahttps://www.mathworks.com/matlabcentral/profile/4762096-valentina-unakafova711362019-04-08T16:53:25Z2019-04-08T16:53:25Zplotworkspace - Plot workspace of n-DOF planar robotThis function plots a workspace for a planar n-DOF revolute or prismaticgiven DH parameters and the constraints of all variables.<p>% drawworkspace%{This function plots a workspace for a planar n-DOF revolute or prismaticgiven DH parameters and the constraints of all variables.This function uses Robotics Toolbox by Peter Corke which can bedownloaded from :<a href="https://petercorke.com/wordpress/toolboxes/robotics-toolbox----------------------------------------------InputsDH">https://petercorke.com/wordpress/toolboxes/robotics-toolbox----------------------------------------------InputsDH</a> DH parameters each row is a linkq a cell input contains constraints for all variables ordered from first link to last link.---------------------------------------------------------------------Examplea1 = 0.5; a2 = 0.3; a3 = 0.2;DH(1) = Link([0 0 a1 0]);DH(2) = Link([0 0 a2 0]);DH(3) = Link([0 0 a3 0]);th1 = (-pi/6:0.05:pi/6) ;th2 = (-2*pi/3:0.05:2*pi/3);th3 = (-pi/2:0.05:pi/2) ;q = {th1,th2,th3};All copyrights go to Mohammad Al-FetyaniUniversity of Jordan</p>Mohammad Al-Fetyanihttps://www.mathworks.com/matlabcentral/profile/10228928-mohammad-al-fetyani683412019-08-05T09:55:32Z2019-08-05T09:55:32ZReadCompressedJpegSEQRead compressed or uncompressed monochrome NorPix image sequence in MATLAB.This script can read all frames or a set reading window.<p>Read compressed or uncompressed monochrome NorPix image sequence in MATLAB.This script can read all frames or a set reading window.Reading window for compressed sequences requires a separate .idx filenamed as the source file (eg. test.seq.idx).INPUTS fileName: String containing the full path to the sequence frames: 1x2 double array of beginning and end frameOUTPUTS ImageCellArray: Cell array with images and timestamps of all allocated frames.EXAMPLES Read frames 2 to 13: ImageCellArray = ReadJpegSEQ('C:\test.seq',[2 13]) Read all frames: ImageCellArray = ReadJpegSEQ('C:\test.seq',[0 0])Last modified 05.08.2019 by Paul Sifert, PhDGoethe-University <a href="mailto:Frankfurtsiefert@bio.uni-frankfurt.deBased">Frankfurtsiefert@bio.uni-frankfurt.deBased</a> on the work of Brett Shoelson (Norpix2MATLAB_MarksMod.m)Thanks to NorPix support (Daniel Wang) for providing sequence informationThis code was tested with Norpix SEQ8-bit monochrome 75% lossy jpeg compression (24.07.2018)8-bit monochrome uncompressed (03.06.2019)Please report any bugs and improvement suggestions</p>Paul Sieferthttps://www.mathworks.com/matlabcentral/profile/8337810-paul-siefert719032019-06-21T06:33:46Z2019-06-21T06:33:46ZcquiverColor quiver based on magnitude or angle.Also, support uniform sampling by averaging or taking the fastest velocity within each grid cell.<p>cquiver(x, y, u, v) plots quiver for at given points (x, y) with the velocity (u, v)quiv = cquiver(x, y, u, v) returns quiver structure with two properties,Head and Tail. Here, Head and Tail are the patches which are used for drawing heads and tails.quiv = cquiver(x, y, u, v, 'cdata', 'angle') set color based on angle.quiv = cquiver(x, y, u, v, 'sampling', h) plots quiver plotat uniform grid where grid size is h.Default sampling method is average.Sampling method can be changed to 'fastest' by usingquiv = cquiver(x, y, u, v, 'sampling', h, 'samplingmethod', 'fastest')In this case, the fastest one will be chosen from the rectangle(X(i)-h/2, X(i)+h/2) x (Y(i)-h/2, Y(i)+h/2).If you found a bug, feel free to contact me via email in the m-file.</p>Kim Dohyunhttps://www.mathworks.com/matlabcentral/profile/12615697-kim-dohyun646502019-05-29T11:22:17Z2019-05-29T11:22:17Zvecrastvecrast is a function that allows to save a figure with mixed vector and raster content<p>vecrast is a function that allows to automatically save a figure with mixed vector and raster content. More specifically, two copies of the figure of interest are created, rasterFigure and vectorFigure. Patches, surfaces, contours, images, and lights are kept in rasterFigure but removed from vectorFigure. rasterFigure is then saved as a temporary .png image with the required resolution. The .png file is subsequently inserted into the vectorFigure, and the result is saved in a single vector file.</p>Theodoros Michelishttps://www.mathworks.com/matlabcentral/profile/4222556-theodoros-michelis684602019-07-24T13:46:39Z2019-07-24T13:46:39ZmsgboxFontSizeChange the fontsize and other text properties in a msgbox(), errordlg(), warndlg() etc.<p>h = msgbox('Hello world (20 pt font)', 'Example');msgboxFontSize(h, fontsize)msgboxFontSize(h, fontsize, 'FontName', 'Consolas', 'Color', 'b')msgboxFontSize(h, fontsize, 'ignorebuttons', true) % does not apply change to buttons. The text properties in Matlab's msgbox(), errordlg(), warndlg(), etc cannot be directly edited and the default 'fontsize' is quite small. This function gets around that problem by searching for text within the msgbox handle, changes its fontsize, and then changes the window size to fit the new fontsize. The position of the lower, left corner of the msgbox will not change and the resize property is turned on. Additional name-value text properties can be set except for 'units' (see examples). Outputs include the handle to the text object and handles to all pushbuttons. The help section shows how to get the handle to the icon in errordlg & warndlg as well. List of text properties: <a href="https://www.mathworks.com/help/matlab/ref/matlab.graphics.primitive.text-properties.html**">https://www.mathworks.com/help/matlab/ref/matlab.graphics.primitive.text-properties.html**</a> Also see supersizeme() which contains an interactive GUI with a slider that allows you to scale the font size of all text within a figure or axes. <a href="https://www.mathworks.com/matlabcentral/fileexchange/67644-supersizeme">https://www.mathworks.com/matlabcentral/fileexchange/67644-supersizeme</a></p>Adam Danzhttps://www.mathworks.com/matlabcentral/profile/3753776-adam-danz697992019-08-12T20:52:40Z2019-08-12T20:52:40ZDragDataTipCreates draggable data tips with custom labeling options on most 2-D plots. Custom labels options can also be applied to standard data tips.<p>This function provides a solution to the limited positions allowed by standard MATLAB Data Tips onmost 2-D plots by replacing them with draggable versions when the plot's "Data Tips" mode istoggled 'off'. Since standard data tips can only be moved to a position where one of its fourcorners touches the chosen data point, this often obstructs portions of nearby graphed data.Draggable data tips can be moved anywhere on the current axes, thus allowing better visibility ofthe plot. Several visual features are used to reference the draggable data tip to its data pointand parent object. These include a connecting line between the data tip textbox and itscorresponding data point, and the data tip border will try to utilize the same line properties asthe target line object.The varargin input argument allows the user to optionally customize the data tips labels. Forexample X- and Y-value labels can be replace with something more descriptive such as 'Time' and'Accel'. In addition to axis labels and when a plot legend is used, a header label can be added tothe data tip. Headers are added above the axis labels and match the target object's display nameas it appears in the legend. While the data tip header feature requires a legend to exist prior tocreation of the data tip, the legend can be deleted after creating the data tip and will noteffect the header label. If a legend does not exist when the data tip is created, the headeroption is ignored.Note that optional labels are applied to all axes on a single figure. However, it is stillpossible to use different labels for multiple axes on a single plot. This is done by reapplyingthe function with a new set of labels before creating additional data tips containing the newlabels.An EXAMPLE section is provided in the function notes, but if you have questions or trouble usingthis function, leave a comment below.Please rate it if have a chance; all feedback is welcome.Thanks and enjoy, but don't forget to also download Francois Bouffard's draggable.m function.</p>Allenhttps://www.mathworks.com/matlabcentral/profile/8272669-allen722472019-07-23T22:44:26Z2019-07-23T22:44:26ZColebrookComputes the friction factor in pipes for given values of the Reynolds number (Re) and the relative roughness coefficient (epsilon).<p>MATLAB code to compute the friction factor in pipes for given values of the Reynolds number (Re) and the relative roughness coefficient (epsilon).Syntax: f = colebrook(Re,epsilon) Example 1: Single Re, single epsilon Re = 1e5; epsilon = 1e-4; f = colebrook(Re,epsilon) Example 2: Multiple Re, single epsilon Re = 5000:1000:100000; epsilon = 1e-4; f = colebrook(Re,epsilon*ones(size(Re))); plot(Re,f) Example 3: Multiple Re, multiple epsilon Re = logspace(4,8,100); epsilon = linspace(1e-4,1e-1,100); [RE,EPSILON] = meshgrid(Re,epsilon); F = colebrook(RE,EPSILON); surf(RE,EPSILON,F)</p>Ildeberto de los Santos Ruizhttps://www.mathworks.com/matlabcentral/profile/5153703-ildeberto-de-los-santos-ruiz690072018-10-04T08:40:30Z2018-10-04T08:40:30ZImproved surface smoothThis work is an improved version of the work done by Marc Lalancette, 2014-02-04.<p>New features 2018.10.41. The new input variable "ViewPoint (default [0,0,0])" will help to control the normal direction and reduce the error caused by inconsistent normal direction. If you want to make all normals inward, you could choose a point inside the closed 3D shape.2. Through making every edge distinct in one direction to solve the sparse error problem.3. Solved an error which the code will not work and return the output with all NaN in a case when some vertices are not in faces.With these above improvements, the code is now more general to use.Improved by Chong Wu, City University of Hong Kong, Hong Kong SAR, China, 2018.10.4Improved the normal calculation, revised the sparse error, and NaN error. The original work by Marc Lalancette, Toronto, Canada, 2014-02-04 is: <a href="https://ww2.mathworks.cn/matlabcentral/fileexchange/45416-surfacesmooth?s_tid=srchtitle">https://ww2.mathworks.cn/matlabcentral/fileexchange/45416-surfacesmooth?s_tid=srchtitle</a></p>Chong WUhttps://www.mathworks.com/matlabcentral/profile/13251165-chong-wu694452018-11-15T08:30:30Z2018-11-15T08:30:30ZLocate Starting Point of Signal in Time SeriesLocate starting point of signal in time series. e.g., pulse signal in real-time monitoring.<p>made by halleyhit in about 2013 and published in 2018Email: <a href="mailto:halleyhit@sjtu.edu.cn">halleyhit@sjtu.edu.cn</a> or <a href="mailto:halley-at-hit@163.comWhen">halley-at-hit@163.comWhen</a> receiving time series in experiments, we often find some zeros before wanted signal. Also, it is difficult to locate the starting point with noise pollution. e.g. when locating partial discharge by ultra high frequency sensor, the first step is to locate starting time of each PD pulse.This function uses ENERGY CRITERION algorithm, which can be found in "Sacha M. Markalous, Stefan Tenbohlen and Kurt Feser, Detection and Location of Partial Discharges in Power Transformers using Acoustic and Electromagnetic Signals. IEEE Transactions on Dielectrics and Electrical Insulation Vol. 15, No. 6; December 2008"HOW to useStartingPoint=userstart(TimeSeries)TimeSeries is a double vectorStartingPoint is the order number of starting pointEXAMPLEa=[zeros(1,20) ones(1,20)]+rand(1,40);% Step signal with noiseS=userstart(a) % Starting point</p>halleyhithttps://www.mathworks.com/matlabcentral/profile/3208458-halleyhit376742018-12-14T21:07:47Z2018-12-14T21:07:47ZroundtowardvecRound a vector of values towards a given vector of choices.<p>This function will round an inputed matrix, of any size, and round each value towards the vector of choices given. It can also be given a type of round ('floor','fix','ceil','round','away'), and will round toward -inf,0,inf,closest value, or away from 0 respectively.</p>Tom Rhttps://www.mathworks.com/matlabcentral/profile/3590166-tom-r725192019-08-29T15:40:55Z2019-08-29T15:40:55ZremoveDrivesFromHistoryA solution to the problem of Matlab consuming an enormous amount of time to recover from an "Undefined function or variable" error. <p>The "current folder history" stores paths to directories that were once current (it differs from the search path). When paths from networks end up on the current folder history and the network becomes unavailable, an undefined variable or function (often caused by a typo) may cause an unbearable delay in the error message to appear [1,2,3]. To alleviate this problem, this function produces a GUI that will list all paths on the current folder history and you can select which paths to remove from the history. The GUI will create a backup of your original history in case you want to restore it.This has been developed in Matlab r2017b and does not work with previous releases but the problem did not occur prior to then anyway. This works with PC (I'd love for a collaborator to adapt this to Mac and become a co-author). [1] <a href="https://www.mathworks.com/matlabcentral/answers/395876-undefined-function-error-is-very-slow-to-occur[2]">https://www.mathworks.com/matlabcentral/answers/395876-undefined-function-error-is-very-slow-to-occur[2]</a> <a href="https://www.mathworks.com/matlabcentral/answers/364153-40-seconds-waiting-for-undefined-function-or-variable-error-2017b[3]">https://www.mathworks.com/matlabcentral/answers/364153-40-seconds-waiting-for-undefined-function-or-variable-error-2017b[3]</a> <a href="https://www.mathworks.com/matlabcentral/answers/412972-matlab-218a-stalls-on-undefined-variables">https://www.mathworks.com/matlabcentral/answers/412972-matlab-218a-stalls-on-undefined-variables</a></p>Adam Danzhttps://www.mathworks.com/matlabcentral/profile/3753776-adam-danz