tag:ch.mathworks.com,2005:/matlabcentral/fileexchange/feed?q=type%3AFunctionMATLAB Central File Exchangeicon.pnglogo.pngMATLAB Central - File Exchange - type:FunctionUser-contributed code library2020-07-02T09:17:20-04:0012999160732252019-11-04T09:32:49Z2019-11-04T09:32:49Zmatlab GUI with arduino matlab GUI with arduino <p>matlab GUI with arduino e. saleh saeid bohligae.mail <a href="mailto:zwuitina@yahoo.com">zwuitina@yahoo.com</a></p>saleh said bouhligahttps://www.mathworks.com/matlabcentral/profile/6136849-saleh-said-bouhliga744372020-03-09T23:00:47Z2020-03-09T23:00:47ZboxplotGroupGroup boxplots together along the x-axis with space between groups.<p>x = {rand(100,2), rand(20, 2), rand(150,2)}; boxplotGroup(x)The lines above will create two groups of three boxplot boxes per group, with space separating the groups. You can specify the amount of space between groups, the primary labels under each box, and the secondary labels that identify the groups. Group labels can be horizontal, under the x-axis, or vertical, between groups. Other boxplot properties can be passed to Matlab's boxplot function as well. NOTE: If you're working with a grouping variable 'g', use the syntax boxplot(x,g) along with the "Group Appearance" options described in Matlab's boxplot() documentation.<a href="https://www.mathworks.com/help/stats/boxplot.html#d118e146984Also">https://www.mathworks.com/help/stats/boxplot.html#d118e146984Also</a> see Kelly Kearney's boxplot2()<a href="https://www.mathworks.com/matlabcentral/fileexchange/59303-boxplot2">https://www.mathworks.com/matlabcentral/fileexchange/59303-boxplot2</a></p>Adam Danzhttps://www.mathworks.com/matlabcentral/profile/3753776-adam-danz731032020-06-08T06:55:02Z2020-06-08T06:55:02ZcopyUIAxesCopies UIAxes (eg. AppDesigner) and most properties to a new figure and recreates the legend and colorbar if they exist.<p>Use copyUIAxes() to copy plots in AppDesigner or any UIAxes onto regular axes which can be easily saved, printed, or modified. copyUIAxes copies all children and most properties of a UIAxes to regular axes. If the UIAxes has a legend or colorbar, they can be recreated in the new axes, too. copyUIAxes(ax) creates a new figure and copies the UIAxes (ax) content to the new figure. copyUIAxes(ax, destination) copies the UIAxes to the destination which can be a figure or axis handle. copyUIAxes(ax, 'copyPosition', true) will copy the position properties so the copied axes have the same position relative to the figure as the UIAxes or App.See the file's help section for other optional inputs and several demos. --------------------------------Notes--------------------------------Matlab's copyobj() is not supported with UIAxes (eg. AppDesigner). In r2020a Matlab released exportgraphics() and copygraphics() which do support uiaxes and uifigures and makes parts of copyUIAxes() obsolete.For discussion on this topic: <a href="https://www.mathworks.com/matlabcentral/answers/281318-how-can-i-save-a-figure-within-app-designer">https://www.mathworks.com/matlabcentral/answers/281318-how-can-i-save-a-figure-within-app-designer</a></p>Adam Danzhttps://www.mathworks.com/matlabcentral/profile/3753776-adam-danz643962020-06-22T07:42:46Z2020-06-22T07:42:46Zpoint 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-rik108672020-06-15T12:39:13Z2020-06-15T12:39:13Zuipickfiles: uigetfile on steroidsMany-featured, platform independent file and directory picker.<p>This is a GUI application that allows multiple files or directories to be selected and allows you to manage the list (remove files, reorder, etc.) before returning. It has basic filtering as well as regular expression filtering and navigation of the file system is easy. The output is configurable (cell, struct or char arrays). It is written entirely in M and so is platform independent.</p>Douglas Schwarzhttps://www.mathworks.com/matlabcentral/profile/20355-douglas-schwarz732582019-11-05T20:16:28Z2019-11-05T20:16:28ZMatlab FractalsQuick and dirty MatLab function for Julia and Mandelbrot Sets<p>Plotter for Mandelbrot and Julia sets. Zooming enabled up to doubles precision.Available as standalone app, matlab app, or a function. The function is the most stable and has more freedom but the apps work quite well for people who just want to play with fractals.</p>Avehttps://www.mathworks.com/matlabcentral/profile/16150894-ave670182020-06-26T13:19:26Z2020-06-26T13:19:26Zk-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-ferreira714082020-04-30T20:17:28Z2020-04-30T20:17:28Zdfield8Interactive app to study a given first order ODE<p>This is a nice interactive tool to study first order ODEs, which was originally created by John Polking at Rice University (together with other tools such as pplane and odesolve).The original versions (see also here <a href="https://math.rice.edu/~polking/odesoft/solver.html">https://math.rice.edu/~polking/odesoft/solver.html</a> for more information) only work up to MATLAB versions R2014a. A great version of pplane8 which works in any MATLAB version can be found here: <a href="https://www.mathworks.com/matlabcentral/fileexchange/61636-pplaneNote">https://www.mathworks.com/matlabcentral/fileexchange/61636-pplaneNote</a> that at the time of writing there are a couple of versions on file exchange (both called dfield9) from Gerardo Garcia (<a href="https://www.mathworks.com/matlabcentral/fileexchange/64437">https://www.mathworks.com/matlabcentral/fileexchange/64437</a>) and Iourii Kouznetsov (<a href="https://www.mathworks.com/matlabcentral/fileexchange/65886">https://www.mathworks.com/matlabcentral/fileexchange/65886</a>), however the former gives warnings for versions 2015a and later, and errors out for versions 2017b and later. The latter works without errors or warnings, but the text is disproportionally larger and out of place. Both versions have the toolbar on in the setup window and tend to place the display window a little out of reach in the upper right part of the screen sometimes.This version of dfield8 is the closest to the original in look and feel, but it is faster, and it works for any version from R2014b on.</p>Giampiero Campahttps://www.mathworks.com/matlabcentral/profile/1692307-giampiero-campa140562020-06-19T16:37:35Z2020-06-19T16:37:35ZArrow3Draws lines with directional arrowheads.<p>ARROW3(P1,P2) draws lines from P1 to P2 with directional arrowheads. P1 and P2 are either nx2 or nx3 matrices. Each row of P1 is an initial point, and each row of P2 is a terminal point.ARROW3(P1,P2,S,W,H,IP,ALPHA,BETA) can be used to specify properties of the line, initial point marker, and arrowhead. Type "help arrow3" at the command prompt for more informationWhat's new in Version 5:All arrowhead and initial point marker sizes (W, H, and IP) are relative to the PlotBox diagonal.Version 5 attempts to preserve the appearance of existing axes. In particular, ARROW3 will not change XYZLim, View, or CameraViewAngle. ARROW3 does not, however, support stretch-to-fill scaling. If a particular aspect ratio or variable limit is required, use DASPECT, PBASPECT, AXIS, or XYZLIM commands before calling ARROW3. Users are encouraged to report problems directly to the author.</p>Tom Davishttps://www.mathworks.com/matlabcentral/profile/1274877-tom-davis712212019-12-30T10:00:20Z2019-12-30T10:00:20ZImage 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:Thanh, D. N. H., et al. “BLOOD VESSELS SEGMENTATION METHOD FOR RETINAL FUNDUS IMAGES BASED ON ADAPTIVE PRINCIPAL CURVATURE AND IMAGE DERIVATIVE OPERATORS.” ISPRS - International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences, vol. XLII-2/W12, Copernicus GmbH, May 2019, pp. 211–18, doi:10.5194/isprs-archives-xlii-2-w12-211-2019.Thanh, Dang N. H., et al. “A Skin Lesion Segmentation Method for Dermoscopic Images Based on Adaptive Thresholding with Normalization of Color Models.” 2019 6th International Conference on Electrical and Electronics Engineering (ICEEE), IEEE, 2019, doi:10.1109/iceee2019.2019.00030.Thanh, Dang N. H., et al. “Melanoma Skin Cancer Detection Method Based on Adaptive Principal Curvature, Colour Normalisation and Feature Extraction with the ABCD Rule.” Journal of Digital Imaging, Springer Science and Business Media LLC, Dec. 2019, doi:10.1007/s10278-019-00316-x.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-thanh700322019-10-24T08:05:32Z2019-10-24T08:05:32ZRobust Empirical Mode Decomposition (REMD)A useful adaptive signal processing tool for multi-component signal separation, non-stationary signal processing.<p>The REMD is an improved empirical mode decomposition powered by soft sifting stopping criterion (SSSC). The SSSC is an adaptive sifting stop criterion to stop the sifting process automatically for the EMD. It extracts a set of mono-component signals (called intrinsic mode functions) from a mixed signal. It can be used together with Hilbert transform (or other demodulation techniques) for time-frequency analysis.</p>Liu Zhilianghttps://www.mathworks.com/matlabcentral/profile/12638821-liu-zhiliang746102020-04-11T14:58:18Z2020-04-11T14:58:18ZSimulitis (A Coronavirus Simulation)MATLAB code to replicate Washington Post's Coronavirus simulation<p>I'm sure by now you've all seen the Washington Post article with the COVID-19 simulation, speaking to the public health benefits of social isolation in the face of a highly infectious disease. If you haven't, here's the article: <a href="https://www.washingtonpost.com/graphics/2020/world/corona-simulator/Well">https://www.washingtonpost.com/graphics/2020/world/corona-simulator/Well</a>, out of my quarantine boredom, I recreated this simulation in MATLAB, with more knobs to turn and parameters to play around with. For example, what if some of the carriers can die? What if the disease is Ebola instead (~50% mortality rate)?This function simulates disease transmission among a set of n carriers, in a confined space, with some proportion of carriers socially isolating themselves. A simple multibody physics model (elastic collision between two equal-mass particles) determines carrier trajectory.Hopefully this gives you a fun (albeit brief) respite from the doldrums of social isolation!</p>Joshua Gaffordhttps://www.mathworks.com/matlabcentral/profile/14092049-joshua-gafford542072020-01-20T16:20:23Z2020-01-20T16:20:23Zpolyfix(x,y,n,xfix,yfix,xder,dydx)Fit polynomial p to data, but match exactly at one or more points<p>Sometimes we want to fit a polynomial to some data, but want to force a perfect match to some known values at one or more points. This function returns such a polynomial.</p>Are Mjaavattenhttps://www.mathworks.com/matlabcentral/profile/3934907-are-mjaavatten194602020-01-24T10:40:06Z2020-01-24T10:40:06ZZfitZFIT is a function which can PLOT, SIMULATE and FIT impedance data<p>% Zfit(data)Plots the impedance DATA which has to be a 3-columns wise matrix [FREQ, RealZEXP, ImagZEXP]. Impedance, admittance, capacitance and modulus representations in the complex plane are then pushbutton obtainable.%The others usages are described in the help lines with examples too...</p>Jean-Luc Dellishttps://www.mathworks.com/matlabcentral/profile/869820-jean-luc-dellis720222019-07-03T01:55:58Z2019-07-03T01:55:58ZPOD - Proper Orthogonal Decomposition (Wrapper)By Fernando Zigunov, 2019 [U, S, V] = POD(X) returns the proper orthogonal decomposition<p>=====This function is just a nice wrapper for Matlab's built-in SVD function, whichonly operates in 2D data sets. The wrapper just reshapes the matricesbefore and after applying SVD such that the input series X can ben-dimensional and ensures the output modes U are also n-dimensional.=====%POD has several names (POD, SVD, PCA, ...) and is a mathematical tool that%highlights the principal modes of a random series of variables (i.e.,%financial measurements, fluid flow fields, structural vibrations, neuron%firing patterns, video frames, and basically anything imaginable!)%The POD tool is extremely useful in data analysis to identify the most%energetic modes of a complex system by simply performing measurements when%its operating. (But if you're already here you already know all of this.)%============Inputs:=============%X - Time series or snapshots to be analyzed. Can be a n-dimensional matrix%(n>=2). First dimension is time/snapshot, and all other dimensions are%conserved for output.%============Outputs:=============%U - Mode matrix, has the same size of X. First dimension of X was%"time/snapshot", therefore first dimension of U will be "mode". Modes are%automatically organized from most energetic U(1,:,:...) to least%energetic.%S - Mode eigenvalues. S.^2 gives the mode energies. S is a diagonal%matrix, so returns just the vector S to save one line of post-processing.%V - Mode time-series or snapshot coefficients - V contains the%contribution of each mode to a specific snapshot of X. U*S*V gives back X%(given U and X are reshaped into 2D matrices again).</p>Fernando Zigunovhttps://www.mathworks.com/matlabcentral/profile/10721836-fernando-zigunov740102020-05-14T14:06:00Z2020-05-14T14:06:00ZgetContourLineCoordinatesGet a table of contour line coordinates from a contour object.<p>Use the outputs from any of the contour plot functions to produce a table of (x,y) coordinates of the contour lines organized by contour level and group. [cm, h] = contour(___);contourTable = getContourLineCoordinates(cm);--or-- contourTable = getContourLineCoordinates(h);contourTable = Level.........Group..........X............Y ____________________________________ -5.8504.........1..........0.44266....-1.75 -5.8504.........1..........0.375........-1.8038 -5.8504.........1..........0.25..........-1.8526 -5.8504.........1..........0.125........-1.8498 etc....Where Level is the contour level in the LevelList of a contour object, Group is a grouping variable for contour levels, and (X,Y) are coordinates along the contour lines. </p>Adam Danzhttps://www.mathworks.com/matlabcentral/profile/3753776-adam-danz736702019-12-13T11:49:49Z2019-12-13T11:49:49ZwaitbarParforWaitbar implementation for parfor loops.<p>This package provides a waitbar for use in parfor loops without the need to write to files or any other external synchronization.</p>Girmi Schoutenhttps://www.mathworks.com/matlabcentral/profile/9452059-girmi-schouten728142020-04-16T14:40:30Z2020-04-16T14:40:30ZMultivariate 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-rehman704502020-06-04T03:48:13Z2020-06-04T03:48:13Zkmz2structConverts 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-ellingson728542020-06-02T17:29:55Z2020-06-02T17:29:55ZModel Execution TimeSimulates a Simulink model a number of times and records/plots the execution time.<p>Simulates a Simulink model a number of times and records the execution time data. The results are then plotted, along with the min, max, and mean times. The user can specify how many simulations to perform.</p>Monika Jaskolkahttps://www.mathworks.com/matlabcentral/profile/4417791-monika-jaskolka682392019-07-31T12:33:32Z2019-07-31T12:33:32ZPyColormap4MatlabSimple Matlab and python script that import colormaps from matplotlib into Matlab.<p><a href="https://github.com/f-k-s/PyColormap4Matlab/blob/master/README.mdSimple">https://github.com/f-k-s/PyColormap4Matlab/blob/master/README.mdSimple</a> Matlab and python script that import colormaps from matplotlib into Matlab.getPyPlot_cMap returns any colormap implemented in the matplotlib python library. It calls a python script that writes the colormap matrix into a temporary file, i.e. PYTHON (and the matplotlib module) is REQUIRED. However, the advantage is that you get all the colormaps implemented in matplotlib and that you can specify the number of RGB quantization levels, i.e. the number of colors of the colormap.A list of colormap names is provided in the function help section. getPyPlot_cMap('!GetNames') returns a cellstring containing all available colormap names. See <a href="https://matplotlib.org/examples/color/colormaps_reference.html">https://matplotlib.org/examples/color/colormaps_reference.html</a> for an illustration of colormaps.=================================================UsagecMapNames = getPyPlot_cMap('!GetNames')Returns a cellstring containing all available colormap names.cMap = getPyPlot_cMap(cMapName)Returns the colormap cMapName with the default of 128 colors. cMap will be a 128x3 matrix.cMap = getPyPlot_cMap(cMapName, NumberOfColors)Specify the number of colors, i.e. the number of rows in cMap.cMap = getPyPlot_cMap(cMapName, NumberOfColors, keepAlphaChannel)If keepAlphaChannel is not 0 cMap has a 4th column containing the alpha channel.cMap = getPyPlot_cMap(cMapName, NumberOfColors, keepAlphaChannel, pythonSystemCommand)Lets you specify the python command (possibly including a path, see below) used to execute the python script.=================================================ErrorsIf you have python installed but Matlab says 'There was an error executing the command... System returned:...' you can try to pass the path to your python installation explicitly as the 4th parameter, e.g.:cmp = getPyPlot_cMap('Accent', [], [], '"c:\Program Files\Python37\python.exe"');Note the double-quotes around the path, which are neccessary because of the containing space character.</p>Konradhttps://www.mathworks.com/matlabcentral/profile/4143216-konrad732462020-03-13T05:42:17Z2020-03-13T05:42:17ZPrincipal Component Analysis (PCA) on images in MATLAB (GUI)Principal Component Analysis (PCA) on images in MATLAB (GUI)<p>First, upload a colour image by clicking on the “upload an image button”. The acceptable image formats are png, jpg, jpeg, img and tif. Then click on the "Plot the grayscale image". After that enter the no. of PC's up to which you want to retrieve the images (both colour and grayscale).An error message/box will pop-up when you enter a number greater than the no. of PCs for that particular image. Also, an error will message will pop-up when the entered input is not a number.Please go through this link for detail explanation;<a href="https://medium.com/@abhilash.singh/principal-component-analysis-pca-on-images-in-matlab-a-graphical-user-interface-gui-3d4999ddd0d0Enjoy">https://medium.com/@abhilash.singh/principal-component-analysis-pca-on-images-in-matlab-a-graphical-user-interface-gui-3d4999ddd0d0Enjoy</a>!!!</p>ABHILASH SINGHhttps://www.mathworks.com/matlabcentral/profile/5569287-abhilash-singh747622020-03-29T18:35:09Z2020-03-29T18:35:09ZSIRModelSimulation% This file simulates SIR model for the spread of infectious diseases<p>% Np = the population of the community. (Default = 100, so you easily % read the percentage of the community infectious/infected)% Ni = the number of index case (initial infecious individual, Default = 1).% Ds = is the minimum safe distance below which the probability of being % infected is Prinf (Measure of how contagious the disease is: % Lower means more contagious. Default = 0.05).% Prinf = probability that you will be infected if you are closer than Ds % to an infectious iindividial (Measure of how precautious people % are: washing hands, not touching mucus membrane. Default = 0.2).% Tr = Time it takes for an individual to be removed from the population % (Death, Quarantined, Recovered and become immuned. Default = 1).% F = Relative repulsive force strength (measure of social distancing Default = 1)% videoname = Simulation video file name</p>Lateef Adewale Kareemhttps://www.mathworks.com/matlabcentral/profile/2376472-lateef-adewale-kareem695342020-06-10T17:46:03Z2020-06-10T17:46:03Zautofft - FFT analyzerFrequency analyser useful for interpretation of experimental data or a comparison of theoretical results with measurements.<p>Signal Processing Toolbox™ provides several functions to power spectrum estimation, including pspectrum and stft. Although these functions are excellent and well-documented, they might be cumbersome in some engineering applications. These applications include estimating magnitudes of vibration, noise and other discrete-time signals in engineering units or a comparison of theoretical results with measurements.In such applications, you can use autofft, a Matlab function for estimation of the discrete Fourier transform (DFT) which mimics options of the Brüel & Kjaer FFT analysers. Based on your input, autoFFT segments signal, applies window functions and spectral averaging. The resulting DFT can be returned in various engineering spectral units including magnitude, RMS, peak-to-peak and power spectral density (PSD). autofft can also estimate spectral derivation or spectral integral of DFT and even perform the short-time Fourier transform (STFT).Note that autoFFT requires the Signal Processing Toolbox in order to generate window functions and estimate PSD accurately.If you have any suggestions and comments or if you want to report a bug, feel free to contact me via e-mail carlist(at)ntis.zcu.cz.</p>Lubos Smolikhttps://www.mathworks.com/matlabcentral/profile/7835462-lubos-smolik753232020-05-02T15:03:19Z2020-05-02T15:03:19ZRadar Basic SimulationRoundtrip Time Computation <p>A simple radar simulation which computes the roundtrip time of radar pulse based on the radar distance traveled.</p>Bryan Nograhttps://www.mathworks.com/matlabcentral/profile/18152830-bryan-nogra698112020-01-23T23:39:54Z2020-01-23T23:39:54ZZfitGUIZfitGUI creates a figure with uimenus devoted to process impedance data<p>The main features are: Graphical. The data can be plotted for each immitance types (Z, Y, C or M), in the complex plane, as well as their real, imaginary parts or their magnitude in function of the frequency (Log/Log scales). Simulation. The possibilities are almost infinite. Over the classical R, C, L electrical elements, one can use CPE (constant Phase Element) and Diffusion Impedances. Fitting. ZfitGUI makes use of the simplex algorithm. To fit only portion of the spectra is user-friendly. Note that there exists the programmatic version of ZfitGUI named "Zfit" which can be found in the Matworks site file exchange.</p>Jean-Luc Dellishttps://www.mathworks.com/matlabcentral/profile/869820-jean-luc-dellis222392020-06-11T01:52:38Z2020-06-11T01:52:38Znum2strexact (exact version of num2str)num2strexact does exact conversion of number to string based on IEEE floating point bit pattern<p>num2strexact is a self-building C-mex function that converts a double or single input to the exact decimal string. The conversion is done with hundreds of digits of precision to maintain the exact conversion. The conversion uses the exact decimal value of each bit of the IEEE double precision floating point format along with the exact application of 2^exponent. Inf and NaN bit patterns are recognized, and denormalized numbers are handled also.Don't confuse the exact conversion with significance! Double numbers will only be significant to about 15 decimal digits, and single numbers will only be significant to about 7 decimal digits. For example,>> format hex>> 1.2ans = 3ff3333333333333>> num2strexact(1.2)ans = 1.1999999999999999555910790149937383830547332763671875>> 1.2 + eps(1.2)ans = 3ff3333333333334 <-- one bit different from 1.2num2strexact(1.2 + eps(1.2))ans = 1.20000000000000017763568394002504646778106689453125>> num2strexact(eps(1.2))ans = 2.220446049250313080847263336181640625e-16You can see that 1.2 is not represented exactly in IEEE double format. The difference shows up in the 18th digit for this example. Then note that the very next number in the IEEE double format model is about 2e-16 bigger. The exact conversions are shown for each number, but they are not significant beyond the 16th digit shown. There are no numbers in between these two numbers that can be represented in IEEE double format.Syntax: Y = num2strexact(X [,'fixed' or 'float']) [Y1 Y2] = num2strexact(X1,X2 [,'fixed' or 'float']) [Y1 Y2 Y3] = num2strexact(X1,X2,X3 [,'fixed' or 'float']) : : etc etcX = double or single or halfNOTE: The half type can be input in one of two ways: 1) A uint16 class variable containing the half bit patterns 2) A half class variable. num2strexact must have access to the underlying bit patterns, so if you input a half class variable, then this will first be converted to the equivalent integer bit patterns with the storedInteger function (a temporary deep copy).The number of inputs must match the number of outputs, except in thespecial case of 1 input and 0 outputs where the result will simply beput into ans. If the input is a scalar, the output will be a char string.If the input is any other size array, the result will be a cell array ofthe same dimensions as the input, with each cell containing the charstring conversion of the corresponding element.The optional 'fixed' argument forces the result to be fixed point.The optional 'float' argument forces the result to be floating point. Allnumbers will be printed with exponents, even if the exponent is 0.The default will be fixed or floating point depending on the size of thedecimal exponent. Numbers with -1 <= (decimal exponent) <= 2 will bedisplayed as fixed point, else the number will be displayed as floatingpoint.All NaN bit patterns, regardless of the sign bit and payload, will bereturned simply as the string 'NaN'.Infinity bit patterns will be returned as 'Inf' or '-Inf' as appropriate.num2strexact gives similar results to the following NUM2IEEE function by Steven Lord:<a href="http://www.mathworks.com/matlabcentral/fileexchange/2996except">http://www.mathworks.com/matlabcentral/fileexchange/2996except</a> that num2strexact does not require the Symbolic Math Toolbox to display the potentially hundreds of exact digits, and num2strexact runs much faster.</p>James Tursahttps://www.mathworks.com/matlabcentral/profile/756104-james-tursa722472019-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-ruiz725342019-10-31T14:20:46Z2019-10-31T14:20:46ZKuramoto'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/10/30/stability-of-kuramoto-oscillators/">https://blogs.mathworks.com/cleve/2019/10/30/stability-of-kuramoto-oscillators/</a></p>Cleve Molerhttps://www.mathworks.com/matlabcentral/profile/349729-cleve-moler704472020-04-04T16:21:28Z2020-04-04T16:21:28ZFast 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-rumaithi646922019-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-beauducel738952020-01-11T21:18:11Z2020-01-11T21:18:11ZgitToo simple git wrapper makes it possible to call git as if it is a MATLAB command (given you have installed git and added to system path).<p>Too simple git wrapper combines all string arguments, decorates with spaces, appends 'git' and executes the result using MATLAB's system() command. That's it, and nothing else!This tool is made for simple, quick and dirty git usage through MATLAB command prompt. Nothing beyond that is promised.If you need more functionality, check out this link: <a href="https://stackoverflow.com/questions/42271061/matlab-git-by-command-windowUsage">https://stackoverflow.com/questions/42271061/matlab-git-by-command-windowUsage</a> examples:git --versiongit init awesome_projectgit pullgit commit -m 'awesome message'git push...</p>Hiranhttps://www.mathworks.com/matlabcentral/profile/5788470-hiran546812020-01-31T18:22:11Z2020-01-31T18:22:11ZFeature fusion using Canonical Correlation Analysis (CCA)Feature level fusion using Canonical Correlation Analysis (CCA)<p>Feature fusion is the process of combining two feature vectors to obtain a single feature vector, which is more discriminative than any of the input feature vectors. CCAFUSE applies feature level fusion using a method based on Canonical Correlation Analysis (CCA). It gets the train and test data matrices from two modalities X and Y, and consolidates them into a single feature set Z. Details can be found in: M. Haghighat, M. Abdel-Mottaleb, W. Alhalabi, "Fully Automatic Face Normalization and Single Sample Face Recognition in Unconstrained Environments," Expert Systems With Applications, vol. 47, pp. 23-34, April 2016. <a href="http://dx.doi.org/10.1016/j.eswa.2015.10.047">http://dx.doi.org/10.1016/j.eswa.2015.10.047</a> (C) Mohammad Haghighat, University of Miami <a href="mailto:haghighat@ieee.org">haghighat@ieee.org</a> PLEASE CITE THE ABOVE PAPER IF YOU USE THIS CODE.</p>Mohammad Haghighathttps://www.mathworks.com/matlabcentral/profile/2857455-mohammad-haghighat608662020-02-28T03:24:14Z2020-02-28T03:24:14Zpairplot(meas, label, group, colors, mode)plot pairwise relationships in matrix<p>plot pairwise relationships in matrix : similar to 'pairplot' in seaborn (<a href="http://seaborn.pydata.org/generated/seaborn.pairplot.html)easier">http://seaborn.pydata.org/generated/seaborn.pairplot.html)easier</a> than 'plotmatrix'% e.g. % For stat toolbox users load fisheriris.mat colors = lines(3); label = {'sepal-length', 'sepal-width', 'petal-length', 'petal-width'} figure; pairplot(meas, label, species, colors, 'both');% For all users load Fisher.mat % included in zip group= Fisher(:,1); colors = lines(length(unique(group))); figure; pairplot(Fisher(:,2:size(Fisher,2)), {'PW', 'PL', 'SW', 'SL'}, num2cell(num2str(group)), colors, 'bar'), ylabel('Probability') figure; pairplot(meas, label, species, colors, 'both');</p>Ryosuke F Takeuchihttps://www.mathworks.com/matlabcentral/profile/3438634-ryosuke-f-takeuchi741362020-06-20T19:17:51Z2020-06-20T19:17:51ZPolygon Area Metric for Classifier EvaluationAydemir, O. A New Performance Evaluation Metric for Classifiers: Polygon Area Metric. J Classif (2020). https://doi.org/10.1007/s00357-020-0<p>Classifier performance assessment (CPA) is a challenging task for pattern recognition. In recent years, various CPA metrics have been developed to help assess the performance of classifiers. Although the classification accuracy (CA), which is the most popular metric in pattern recognition area, works well if the classes have equal number of samples, it fails to evaluate the recognition performance of each class when the classes have different number of samples. To overcome this problem, researchers have developed various metrics including sensitivity, specificity, area under curve, Jaccard index, Kappa, and F measure except CA. Giving many evaluation metrics for assessing the performance of classifiers make large tables possible. Additionally, when comparing classifiers with each other, while a classifier might be more successful on a metric, it may have poor performance for the other metrics. Hence, such kinds of situations make it difficult to track results and compare classifiers. This study proposes a stable and profound knowledge criterion that allows the performance of a classifier to be evaluated with only a single metric called as polygon area metric (PAM). Thus, classifier performance can be easily evaluated without the need for several metrics.</p>Önder Aydemirhttps://www.mathworks.com/matlabcentral/profile/11213465-onder-aydemir710532019-09-04T17:38:25Z2019-09-04T17:38:25Zfigure2pdfExport the current MATLAB figure to a PDF file.<p>Export the current MATLAB figure to a PDF file.This function is useful for preparing high-quality graphic files for research papers.</p>Ildeberto de los Santos Ruizhttps://www.mathworks.com/matlabcentral/profile/5153703-ildeberto-de-los-santos-ruiz720922019-08-16T13:55:21Z2019-08-16T13:55:21Z2D Vortex Core Tracking - Gamma 1 - Super FastIdentifies 2D vortices using Gamma 1 from Graftieaux<p>Based on and inspired by Sebastian Endrikat <a href="https://www.mathworks.com/matlabcentral/fileexchange/52343-find-vortices-in-velocity-fieldsUnderlying">https://www.mathworks.com/matlabcentral/fileexchange/52343-find-vortices-in-velocity-fieldsUnderlying</a> math presented by L Graftieaux "Combining PIV, POD and vortex identification algorithms for the study of unsteady turbulent swirling flows" <a href="https://iopscience.iop.org/article/10.1088/0957-0233/12/9/307/pdfThanks">https://iopscience.iop.org/article/10.1088/0957-0233/12/9/307/pdfThanks</a> a lot!Sebastian's code is rather slow, though, because it uses 4 nested for loops. Producing the gamma1 map can be done more efficiently in Matlab by realizing that the operations described in the Graftieaux's paper can be rearranged into two convolutions. This code does that, basically. It also find the maximum gamma 1 by fitting a spline curve, therefore not being limited by the grid resolution of the vector field.The drawback is that it'll find only one vortex core, which might not be desired in some applications where multiple vortices form. One can, however, use the second output (G1) to perform their own peak finding/thresholding to find multiple vortex cores.Write-up of the details on <a href="https://zigunov.com/2019/07/08/finding-vortex-cores-with-gamma-1/Hope">https://zigunov.com/2019/07/08/finding-vortex-cores-with-gamma-1/Hope</a> it was useful!-FZ</p>Fernando Zigunovhttps://www.mathworks.com/matlabcentral/profile/10721836-fernando-zigunov554052020-01-31T18:18:13Z2020-01-31T18:18:13ZFeature fusion using Discriminant Correlation Analysis (DCA)Feature fusion using Discriminant Correlation Analysis (DCA)<p>Feature fusion is the process of combining two feature vectors to obtain a single feature vector, which is more discriminative than any of the input feature vectors. DCAFUSE applies feature level fusion using a method based on Discriminant Correlation Analysis (DCA). It gets the train and test data matrices from two modalities X and Y, along with their corresponding class labels and consolidates them into a single feature set Z. Details can be found in: M. Haghighat, M. Abdel-Mottaleb, W. Alhalabi, "Discriminant Correlation Analysis: Real-Time Feature Level Fusion for Multimodal Biometric Recognition," IEEE Transactions on Information Forensics and Security, vol. 11, no. 9, pp. 1984-1996, Sept. 2016. <a href="http://dx.doi.org/10.1109/TIFS.2016.2569061">http://dx.doi.org/10.1109/TIFS.2016.2569061</a> and M. Haghighat, M. Abdel-Mottaleb W. Alhalabi, "Discriminant Correlation Analysis for Feature Level Fusion with application to multimodal biometrics," IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), 2016, pp. 1866-1870. <a href="http://dx.doi.org/10.1109/ICASSP.2016.7472000">http://dx.doi.org/10.1109/ICASSP.2016.7472000</a> (C) Mohammad Haghighat, University of Miami <a href="mailto:haghighat@ieee.org">haghighat@ieee.org</a> PLEASE CITE THE ABOVE PAPER IF YOU USE THIS CODE.</p>Mohammad Haghighathttps://www.mathworks.com/matlabcentral/profile/2857455-mohammad-haghighat676442019-07-11T19:54:58Z2019-07-11T19:54:58ZsupersizemeQuickly increase/decrease the font size of all text in a figure by a chosen factor.<p>Quickly make your figures ready for presentations by scaling font sizes.supersizeme(1.5) will search for all text in the current figure and multiply the individual font sizes by 1.5. supersizeme(-1.5) or will decrease the font sizes by a factor of 1.5; same as supersizeme(1/1.5).supersizeme(h, 2) will double the font sizes in the figure, axis, or object handle 'h'. 'h' can be a vector of handles, too.supersizeme() or supersizeme('+') will increase all font sizes in the current figure by a default value.supersizeme('-') will decrease all font sizes in the current figure by a default value. supersizeme('interactive') will produce a GUI with a slider allowing you to scale all font sizes interactively within the current figure, axes, or object handle. The function has also been adapted to work with TeX markup strings.Please report any bugs to the email address listed in the file. </p>Adam Danzhttps://www.mathworks.com/matlabcentral/profile/3753776-adam-danz749932020-04-13T21:51:03Z2020-04-13T21:51:03ZGet sheet names from Excel fileReads the sheet names from Excel file for the given format :: .xls, .xlsm, .xlsx, .xltm, .xltx, .xltm<p>Reads the sheet names from Excel file for the given format :: .xls, .xlsm, .xlsx, .xltm, .xltx, .xltm%%********************************************************************************% Name : xl_xlsfinfo% Author : Pruthvi Raj G% Version : Version 1.0 - 2011b Compactible% Description : Finds all the sheets in the Excel file ( .xls, .xlsm, .xlsx, .xltm, .xltx, .xltm)% Input : File_Name with path included.% Date : 11-Feb-2020%% Examples : xl_xlsfinfo('D:\Pruthvi\Test_file.xls')%*********************************************************************************</p>Pruthvi Raj Gampalwarhttps://www.mathworks.com/matlabcentral/profile/10761452-pruthvi-raj-gampalwar703482020-04-07T21:40:03Z2020-04-07T21:40:03ZDraw randomly centered circles of various sizesSet the range of radii, density, and other parameters to create a plot that draws randomly centered polygons with or without overlap.<p>This function plots circles or other polygons at random positions with varying radii. All input parameters are optional including the axes size, the range of radii, number of vertices per bubble (eg, polygon shape), density, the amount of space between bubbles or how much they can overlap, how they should fit within the figure, and other parameters. A figure is produced and there are four outputs that allow the user to make further changes to the plotted objects or to recreate the exact same plot. More detail is included at the top of the function and I've provided examples of how to use the outputs to add color, calculate the area of each circle, count the number of circles for each circle size, etc. Follow this page for updates.</p>Adam Danzhttps://www.mathworks.com/matlabcentral/profile/3753776-adam-danz721242019-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-chauvenet761982020-05-28T04:12:37Z2020-05-28T04:12:37Zgif2aviConverts GIF images to AVI (or MP4) video files.<p>gif2avi(file) converts a gif file to an avi video and saves it to the current directory. gif2avi(file, destination) specifies where the avi file should be saved and its file name. gif2avi(file, '.mp4') converts to mp4 file.gif2avi(file, [ ], 'nLoops', n) records the gif loop n-times.Set the profile (output file type), FrameRate, Colormap, and Quality in VideoWriter by using name-value parameter inputs.aviFile = gif2avi(__) returns the full path to the avi file. [~, vidObj] = gif2avi(__) returns the VideoWriter object.When complete, a message is printed to the command window indicating the location of the output file. Special thanks to Walter Roberson for feedback that improved this submission. </p>Adam Danzhttps://www.mathworks.com/matlabcentral/profile/3753776-adam-danz683412019-11-06T11:27:29Z2019-11-06T11:27:29ZReadCompressedJpegSEQRead 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. headerInfo: Struct with header information (ImageWidth, ImageHeight, ImageBitDepth, ImageBitDepthReal, ImageSizeBytes, ImageFormat, AllocatedFrames, Compression, HeaderVersion, HeaderSize, Description, TrueImageSize, FrameRate).EXAMPLES Read frames 2 to 13: ImageCellArray = ReadJpegSEQ('C:\test.seq',[2 13]) Read all frames: ImageCellArray = ReadJpegSEQ('C:\test.seq',[0 0]) Show header information: [ImageCellArray, headerInfo] = ReadJpegSEQ('C:\test.seq',[0 0])Last modified 06.11.2019 by Paul Siefert, 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-siefert702792020-06-05T18:10:56Z2020-06-05T18:10:56ZQuantilesCalculate the quantiles of a vector or matrix data using linear interpolation.<p>Example using matrix X = [1 2; 2 5; 3 6; 4 10; 7 11; 10 13];p = [0.25 0.50 0.75];Q = quantile(X,p)Q = 2.2500 5.25003.5000 8.00006.2500 10.7500See more examples described in the script files.</p>David Ferreirahttps://www.mathworks.com/matlabcentral/profile/8649959-david-ferreira481432019-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-papachristoudis757582020-05-22T02:25:28Z2020-05-22T02:25:28ZInpaint NaN using GriddataInpaint: Substitute a matrix that has some nan values with interpolated values. <p>This algorithm is inspired by the work of John D'Erricohttps://<a href="http://www.mathworks.com/matlabcentral/fileexchange/4551-inpaint_nansHowever">www.mathworks.com/matlabcentral/fileexchange/4551-inpaint_nansHowever</a>, I do notice that the inpaint_nans algorithm given by John D'Ericco gives a higher gradient compared to griddata. So, this algorithm provides an alternative solution that some people may find it helpful. </p>Kin Sung Chanhttps://www.mathworks.com/matlabcentral/profile/7763866-kin-sung-chan687712020-06-12T23:42:59Z2020-06-12T23:42:59ZTable SQLA script for performing SQL CRUD operations on Matlab tables.<p># INTRODUCTION #Basically, this script is a SQL wrapper around Matlab tables. It is especially useful for those who are new to Matlab and have the habit of "thinking in SQL", or for those who need to accomplish complex data manipulation tasks and struggle to achieve them with the built-in table manipulation functions.# METHODOLOGY & USAGE #The "table_sql" function accepts a single input argument, which must be a valid SQL CRUD statement (DELETE, INSERT, SELECT or UPDATE) where the table names refer to ordinary Matlab tables defined within the main workspace.Once the query is parsed, the script sets up an in-memory instance of the SQLite database, imports the tables, performs the specified SQL statement, synchronizes the workspace tables with the database and returns the result. The content of the latter depends upon the performed operation:> for SELECT statements, an m-by-n table representing the result set returned by the database;> for DELETE, INSERT and UPDATE statements, an integer representing the number of affected rows.# EXAMPLES #1) Setup:load('patients');ids = (1:numel(LastName)).';t1 = table(ids,LastName,Gender,'VariableNames',{'ID' 'LastName' 'Gender'});t2 = table(ids,Age,Height,Weight,'VariableNames',{'ID' 'Age' 'Height' 'Weight'});2) Selections (with and without assignment):t3 = table_sql('SELECT A.ID, A.LastName, B.Age FROM t1 A INNER JOIN t2 B ON B.ID = A.ID');table_sql('SELECT Age, AVG(Height) FROM t1 A INNER JOIN t2 B ON B.ID = A.ID GROUP BY Age ORDER BY Age');3) Modifications:ar = table_sql('DELETE FROM t1 WHERE Gender = "Male"'); t1ar = table_sql('UPDATE t2 SET Age = Age + 1 WHERE Age >= 40'); t2# NOTES #> The script requires a SQLite JDBC driver, which can be downloaded from the following link: <a href="https://bitbucket.org/xerial/sqlite-jdbc/downloads/">https://bitbucket.org/xerial/sqlite-jdbc/downloads/</a>. The ".jar" file must be placed in the script folder.> The column types of the tables being queried are normalized as follows: categoricals and strings become character arrays, logicals become 8-bit integers (bytes), integers become doubles.</p>Tommaso Belluzzohttps://www.mathworks.com/matlabcentral/profile/9773769-tommaso-belluzzo697992019-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-allen724242019-08-13T12:52:21Z2019-08-13T12:52:21ZviolinViolin plot<p>Simple violin plot function using 'fitdist' and 'patch' function.Options to make 1-sided violins, rotate the violin horizontally and add a line for the median.</p>Jasper Fabiushttps://www.mathworks.com/matlabcentral/profile/15949961-jasper-fabius662722019-12-29T11:48:50Z2019-12-29T11:48:50ZMittag-Leffler function with matrix argumentsEvaluate the Mittag-Leffler function with one or two parameters at square matrix arguments<p>This MATLAB functions evaluates the Mittag-Leffler (ML) function with two parameters ALPHA and BETA at the square matrix argument AE = ML(A,ALPHA,BETA) evaluates the ML function with two parameters ALPHA and BETA at the square matrix A argument; ALPHA must be any real and positive scalar, BETA any real scalar and A any real or complex square matrix. E = ML(A,ALPHA) evaluates the ML function with one parameter ALPHA at the square matrix A argument; ALPHA must be any real and positive scalar and A any real or complex square matrix.REFERENCES[1] R. Garrappa and M. Popolizio, Computing the matrix Mittag–Leffler function with applications to fractional calculus, Journal of Scientific Computing, 2018, 17(1), 129-153 - doi: <a href="https://doi.org/10.1007/s10915-018-0699-5[2]">https://doi.org/10.1007/s10915-018-0699-5[2]</a> R. Garrappa, Numerical Evaluation of two and three parameter Mittag-Leffler functions, SIAM Journal of Numerical Analysis, 2015, 53(3), 1350-1369.</p>Roberto Garrappahttps://www.mathworks.com/matlabcentral/profile/2361481-roberto-garrappa739722020-01-20T12:42:53Z2020-01-20T12:42:53ZVectorized CandleCandlestick chart.<p>this is exactly Matlab candle plot but in vectored mode.the plotting speed have been changed dramatically.</p>Abolfazl Nejatianhttps://www.mathworks.com/matlabcentral/profile/7910968-abolfazl-nejatian150182020-04-12T13:40:15Z2020-04-12T13:40:15ZcreateButtonLabel(string,varargin)Easily label pushbuttons with (rotated, vertical, or multi-line) text.<p>buttonIcon = createButtonLabel(string,PVs,figOpt)Have you ever been frustrated by an inability to label a vertically oriented pushbutton or uicontrol with a string? This function is for you!All valid Parameter-Value pairs, INCLUDING TEXT ROTATION, are supported. Note that this function requires the Image Processing Toolbox, and that it triggers the creation of a temporary figure, which will be momentarily visible during button-label creation.</p>Brett Shoelsonhttps://www.mathworks.com/matlabcentral/profile/845693-brett-shoelson710722019-07-23T22:50:20Z2019-07-23T22:50:20ZWater PropertiesComputes some physical properties of water dependent on temperature, from 0.1 to 100 celsius.<p>Returns function handles to compute density, viscosity, and bulk modulus of water dependent on temperature, from 0.1 to 100 celsius.</p>Ildeberto de los Santos Ruizhttps://www.mathworks.com/matlabcentral/profile/5153703-ildeberto-de-los-santos-ruiz359612019-12-03T19:25:43Z2019-12-03T19:25:43ZZone plate test imageMATLAB function to create a zone plate test image<p>A zone plate is a radially symmetric pattern with low frequencies in the middle and high frequencies near the edge. It is useful for experimenting with frequency- and direction-sensitive filtering and also for testing the anti-aliasing capability of image resizing methods.For more, see:<a href="http://blogs.mathworks.com/steve/2011/07/19/jahne-test-pattern-take-3/http://blogs.mathworks.com/steve/2011/07/22/filtering-fun/">http://blogs.mathworks.com/steve/2011/07/19/jahne-test-pattern-take-3/http://blogs.mathworks.com/steve/2011/07/22/filtering-fun/</a></p>Steve Eddinshttps://www.mathworks.com/matlabcentral/profile/476476-steve-eddins421002020-06-30T12:57:46Z2020-06-30T12:57:46ZReadPhilipsScanPhysLog(filename, channels, skipprep)ReadPhilipsScanPhysLog.m reads Philips scanphyslog files, which are created by Philips MRI scanners.<p>This function can be used to load header information and data samples from Philips scanner logfiles. It can load all data available in the file, or only selected channels. In addition to the raw data, a special marker table will be returned which contains indexing information of all detected events in the marker channel.Examples:D = ReadPhilipsScanPhysLog('SCANPHYSLOG20110420142406.log');Reads all physiological channels and marker flags. The marker indexinformation will automatically put into D.M and D.I.D = ReadPhilipsScanPhysLog('SCANPHYSLOG20110420142406.log',{'v1','v2','resp'});Reads both artefact corrected VCG and respiration channels. The marker indexinformation will automatically put into D.M and D.I.D = ReadPhilipsScanPhysLog('SCANPHYSLOG20110420142406.log','none');Ignore channels, and only load markers (i.e. DATA.C==[])[D H] = ReadPhilipsScanPhysLog('SCANPHYSLOG20110420142406.log');Also parses the header and stores info in H.Use start/stop markers to extract epochs: beginindex = D.M(find(D.M(:,1)==16),2); endindex = D.M(find(D.M(:,1)==32),2); epoch = D.C(beginindex:endindex,:);However, the start marker is not properly synchronized with the onset of the first volume. As a workaround you could use the end-marker and real duration of the scan and calculate the start index yourself: freq=496; % for wireless or 500Hz for older wired VCG systems TR=2.3; nrvolumes=200; endindex = D.M(find(D.M(:,1)==16),2); beginindex = endindex - nrvolumes * TR * freq; epoch = logdata.C(beginindex:endindex,:);CompatibilityDeveloped and tested with Matlab R2009a (7.8.0) - Windows 64-bit.bitand behavior was changed in Version 7 (R14), so you might havecompatibility issues with release before R14.</p>Paul Groothttps://www.mathworks.com/matlabcentral/profile/1460629-paul-groot756532020-05-20T11:53:23Z2020-05-20T11:53:23ZELMELM with accuracy, sensitivity and specificity calculation<p>Modification Extreme Learning Machine code from MR QIN-YU ZHU AND DR GUANG-BIN HUANG by adding calculation of sensitivity and specificity</p>muhammad mahdi ramadhanhttps://www.mathworks.com/matlabcentral/profile/13326086-muhammad-mahdi-ramadhan737512019-12-21T20:02:28Z2019-12-21T20:02:28ZStructural Dynamics: Total response of a damped systemDynamic Analysis: Total response of a damped system<p>This function determines total response of a damped systemInput: Mass, Damping coefficient, Stiffness, Excitation force Output: The file calculates the total response of a damped system including the followings: -Natural circular frequency -Critical damping coefficient -Relative critical viscous damping -Damped circular frequency -Total solution as sum of homogenous and particular solution -Plotting displacement as a function of timeHow to use the function:- Step 1: Derive the equation of motion for the whole system in order to obtain total mass, damping, stiffness and excitation values.- Step 2: Determine the particular solution of the system.- Step 3: Determine the coefficients A & B in the homogenous solution according to the initial conditions, so that when (t=0) for u(t), coefficient A is obtained. Derive u(t) and set (t=0) and with help of A, the coefficient B could be obtained.- Step 4: Determine the total solution as a sum of homogenous solution and particular solution.- Step 5: Plot the result.Extra information: Try to experiment on increasing/ decreasing the value of the damping coefficient in order to see the decaying of the vibration.If the system is SDOF and free vibration wants to be plotted, ignore the exciting force & particular solution.</p>Benjamin Bondsmanhttps://www.mathworks.com/matlabcentral/profile/16085184-benjamin-bondsman699722020-06-29T23:38:26Z2020-06-29T23:38:26Zvarargin2optParse varargin cells to option structures<p>This function parses a content of a cell with `{key,value,...}` pairs (usually `varargin`) into an option with fields `opt.key = value`. It allows one to specify input specification and supply validator functions. This is a utility function based on Matlab's `inputParser`.</p>Marcin Konowalczykhttps://www.mathworks.com/matlabcentral/profile/4612692-marcin-konowalczyk730552020-04-04T13:58:07Z2020-04-04T13:58:07Zautomated-nctoolsautomated-nctools is a suite of automated MATLAB functions for netcdf files.<p>automated-nctools is a suite of automated MATLAB functions for netcdf files.For now there is only the following function: ncextract.m function that searches for the nearest k-neighbors to the control points, within regular lonlat grid or does exact comparison to the grid cells of the gridded data.</p>Dimitrios Voulanashttps://www.mathworks.com/matlabcentral/profile/5507841-dimitrios-voulanas