Share Your Experience: Take the 2024 Developer Survey

# Questions tagged [matlab]

MATLAB is a high-level language and interactive programming environment developed by MathWorks. It is the foundation for a number of other tools, including Simulink and various toolboxes that extend the core capabilities.

169 questions
Filter by
Sorted by
Tagged with
118 views

• 5,020
1 vote
389 views

### Calculate distances between two multi-dimensional arrays in Matlab

In question "Dictionary based non-local mean implementation in Matlab", the Manhattan distance between two three-dimensional structures can be calculated by ...
• 5,020
1 vote
88 views

### Dictionary based non-local mean implementation in Matlab

Given a dictionary including multiple X-Y pairs where X, Y are both three dimensional structure. dictionaryBasedNonlocalMean function return a ...
• 5,020
1 vote
109 views

### Finding max number and location in multidimensional array in Matlab

I am attempting to find the maximum value and its location in multidimensional array using Matlab. There are functions findMax3, ...
• 5,020
1 vote
55 views

### Batch generating histograms of images in Matlab

I am attempting to plot histograms for batch of images in Matlab. The file structure of input images and the experimental implementation are listed as below. File structure of input images The matlab ...
• 5,020
126 views

### Three-dimensional DCT spatial frequency components illustration

I am attempting to make three-dimensional discrete cosine transformation spatial frequency components illustration. The 3D cubes is used to present the level of each coefficient. The more bright the ...
• 5,020
161 views

### Matlab vs C: Tensorproduct or Vec-trick (multiple times)

I am searching for a more efficient way to calculate the so called vec-trick used in Tensor algebra, see Wikipedia. Introduction: Suppose you have a matrix vector multiplication, where a matrix C ...
• 133
1k views

### Two dimensional bicubic interpolation implementation in Matlab

I am attempting to implement two dimensional bicubic interpolation algorithm in Matlab. The input is a two dimensional array and the output is the interpolated result. The test input matrix: ...
• 5,020
37 views

### MatLab: Plotting Output Electric Field Spectrum

Goal This code combines two matrices, diagonalizes that matrix, and finds the right and left eigenvectors, right and left eigenvectors are normalized with respect to each other, then it is multiplied ...
• 31
51 views

### Simulate transmission spectrum of extreme ultraviolet laser pulse through laser-dressed finite sample (MATLAB version)

I am currently participating in research on transient absorption spectroscopy and four wave mixing. In the experimental design, an extreme ultraviolet (XUV) laser pulse and infrared (IR) laser pulse ...
65 views

### Finding number of possible arrangements of books on a shelf with a Monte-Carlo approach

The Problem I am trying to determine numerically how many possible ways a number of books can be arranged on a shelf. Specifically, there are x3 categories "physics", "sci-fi", and ...
• 141
1 vote
135 views

### Parallel 3D Discrete Cosine Transformation Implementation in Matlab

I am trying to implement 3D Discrete Cosine Transformation calculation in Matlab with parallel computing parfor. The formula of 3D Discrete Cosine Transformation is ...
• 5,020
1 vote
72 views

### 3D Non-local Mean Algorithm in MATLAB

This is a follow-up question for GetNeighborhood function for 3D cells structure in MATLAB. Based on the existing 2D non-local algorithm, I am attempting to implement 3D non-local mean algorithm in ...
• 5,020
1 vote
52 views

### GetNeighborhood function for 3D cells structure in MATLAB

I am attempting to implement a GetNeighborhood function in order to get a specific region from inputCells by ...
• 5,020
1 vote
194 views

### Calculation of the Distance Matrix in the K-Means Algorithm in MATLAB

Purpose of the code : To assign the corresponding label of the centroids to the points which are close to it. Below is a graphical (2D) example. Variable X is a matrix, rows represent the points, ...
168 views

### Cross-Entropy Minimization - Extreme Code Performance

I'm working on a multivariate cross-entropy minimization model (for more details about it, see this paper, pp. 32-33). It's purpose is to adjust a prior multivariate distribution (in this case, a ...
38 views

### Implementation of calculation of gamma for RBF SVM

I have implemented the calculation of gamma value for RBF SVM as described in Liu et al (2012) [https://ieeexplore.ieee.org/abstract/document/6246300]. Here's a snapshot of the example from the paper: ...
• 129
1 vote
163 views

### Custom Model intended to be used for Curve Fitting. Vectorization vs For Loop and jit numba capabilities

I am new to community and please pardon me if I didn't provide information as intended. This code is supposed to be creating a custom model which will be used with ...
119 views

### Optimizing nested loop for calculating geodesic distance

I segmented an image into N superpixels and constructed a graph based on that in which each superpixel is considered as a node. The information about neighbor superpixels is stored in ...
• 131
203 views

### Vectorizing equations for fsolve

I have a system of 49 equations and 49 unknowns ($x_{1},...,x_{49}$). All equations have the following form. \\$x_{s}\sum_{r=1}^{R}\sum_{t=1}^{T}a_{s,t}b_{rs,t}=\sum_{r=1}^{R}\sum_{t=1}^{T}a_{r,t}...
1 vote
383 views

### My implementation of the Union-Find data structure in MATLAB

I was assigned the connected components labeling (CCL) algorithm and in order to implement the CCL algorithm I first had to implement the Union-Find algorithm. This is my try at it, any review and ...
• 325
60 views

### Reduction of time for the code of sorting RGB and Depth images according to timestamp values

I have RGB Images, Depth images and OpenPose Images(generated from RGB Images). The number of RGB and Depth images are different so I have to find the exactly which RGB images corresponds to which ...
795 views

### My custom implementation of MATLAB's imdilate

I have been assigned to implement the morphological dilation operation without using MATLAB's imdilate, and I came up with the following solution: ...
• 325
1 vote
384 views

### MATLAB / vs Python np.linalg.solve, heat diffusion

I am solving a simple 1D steady heat question using spectral method. I am a long time MATLAB and Mathematica user and trying to learn Python. I compare only linear solving times and Python is way ...
• 35
53 views

### Kernel based conditional increments of many stochastic processes

I have written this function is part of a research project that involves analyzing time-series data from stochastic processes. We have a small number (from 1 to 3) of independent observations of a ...
34 views

### Simulation of splitting particles (MATLAB - Fortran) [closed]

I'm trying to write a code where a charged particle (charge=+20 called dimers), after a certain time, will split into a neutral particle and a smaller charged particle (charge=-10 called monomer). I ...
• 121
85 views

### Finding paths between triangles efficiently in 3D geometry #2

This post is an update of the one from here. I've updated the code and a couple pieces of the post itself. I've been writing some functions used to find paths between two types of triangles - alphas ...
131 views

### Finding paths between triangles efficiently in 3D geometry

An update to this post can be found here I've been writing some functions used to find paths between two types of triangles - alphas and betas. Alphas are triangles that have been in a zone we ...
2k views

### Getting saddle points of a matrix

My homework assignment: Write a function called saddle that finds saddle points in the input matrix M. For the purposes of this problem, a saddle point is defined as an element whose value is ...
• 141
251 views

### Simple SVM in MATLAB

I'm studying SVMs and wrote a demo in MATLAB (because I couldn't get a quadratic programming package to work correctly in Python). Right now it's simple and can only do linearly-separable cases (...
• 235
65 views

### Optimising multiplication of matrix rows with matrix slice/page

I've recently vectorized most of the code for an optimization problem but this one still eludes me. As the procedure and not the actual values are important here, I have replaced the original matrices ...
• 131
796 views

### Artificial Neural Network Classifier in Matlab

I am trying to build a neural network classifier. I have created a neural network with 1 hidden layer (25 neurons) and 1 output layer (1 neuron/binary classification). The dataset I am using has the ...
• 193
90 views

### Applying a function to columns of two matrices producing their combinations

I made a short snippet for applying a function f that takes two arguments (vectors) to columns of two matrices producing all possible combinations of those columns. ...
• 263
458 views

### Draw common tangents to two circles interactively in MATLAB

Requirement After a user draws two circles with their mouse successively, the program should draw all common tangents, if any, to them. Here is my implementation ...
• 513
77 views

### Vector operations

I want to perform the following procedure: I have two vectors x=[1,2,3] and y=[5,7,9] I want to take first element of ...
• 143
103 views

### Applying correction to a time series in Matlab

I face a computation efficiency problem. I have a time series of a non-monotonically drifting variable, that is measurements of objects going through a machine (where the measurement is made) in a ...
451 views

### Calculate Mersenne prime numbers in MATLAB

A Mersenne prime is equal to (2^n - 1), where n is an integer. 31 is a Mersenne prime since 31 = 2^5 -1. I need to write a code that calculates Mersenne primes between 1 and 10,000. Lastly I'm not ...
• 61