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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
41 views

Three-dimensional DCT implementation for GPU computation in Matlab

This is a follow-up question for Three-dimensional DCT spatial frequency components illustration and Parallel 3D Discrete Cosine Transformation Implementation in Matlab. I am trying to perform three-...
  • 3,596
0 votes
0 answers
29 views

Framewise Full-Reference Image Quality Assessment (PSNR and SSIM) for Two Videos in Matlab

Besides the case of No Reference Image Quality Assessment for Video. I am attempting to implement a code snippet for calculating framewise Full-Reference Image Quality Assessment (FR-IQA) (PSNR and ...
  • 3,596
0 votes
0 answers
43 views

No-Reference Image Quality Assessment (NR-IQA) for Video in Matlab - follow-up

This is a follow-up question for No Reference Image Quality Assessment for Video in Matlab. I followed the suggestions proposed by Cris Luengo to make the updated version code in this post. Some of ...
  • 3,596
2 votes
1 answer
63 views

String / Char Vector Concatenation Performance Comparison in Matlab

Considering the suggestion of using modern string arrays instead of char vectors proposed by Cris Luengo, I am trying to make a code snippet for performance comparison of these two cases. The ...
  • 3,596
2 votes
2 answers
97 views

No Reference Image Quality Assessment for Video in Matlab

I am trying to perform the No-Reference Image Quality Assessment (NR-IQA) calculation on video. Several NR-IQA methods including Naturalness Image Quality Evaluator (NIQE), Perception based Image ...
  • 3,596
2 votes
1 answer
160 views

Fractional indexing and interpolation to reconstruct an image

I have a c++ project written as a Matlab Mex program that is constructing an image composed of IxJ pixels. Each pixel value is calculated by finding the contributions to that pixel from all the ...
  • 121
2 votes
1 answer
73 views

Cholesky decomposition

This code is Cholesky decomposition in numerical linear algebra. ...
1 vote
0 answers
27 views

Mean and variance of element-wise distances in a set of multi-dimensional arrays in Matlab - follow-up

This is a follow-up question for Calculate distances between two multi-dimensional arrays in Matlab and Mean and variance of element-wise distances in a set of multi-dimensional arrays in Matlab. For ...
  • 3,596
2 votes
1 answer
43 views

Recursion to generate fractal

I used recursion to generate fractal and got the desired result but I think my code can be better I started using MATLAB a few days ago and since than trying and learning new things. Now this code ...
1 vote
1 answer
41 views

Mean and variance of element-wise distances in a set of multi-dimensional arrays in Matlab

This is a follow-up question for Calculate distances between two multi-dimensional arrays in Matlab. Given a set SX $$ S_{X} = \{ { X_{1}, X_{2}, X_{3}, \dots, X_{n} } \} $$ where n is the count of ...
  • 3,596
1 vote
1 answer
124 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 ...
  • 3,596
1 vote
0 answers
72 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 ...
  • 3,596
1 vote
1 answer
50 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, ...
  • 3,596
1 vote
1 answer
31 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 ...
  • 3,596
0 votes
0 answers
690 views

NIQE score and PIQE score calculation for batch of images in Matlab

There are some image quality assessment methods for "no-reference" image quality analysis (NR-IQA). Here, I am attempting to calculate the NIQE score and PIQE score for batch of images in ...
  • 3,596
3 votes
1 answer
95 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 ...
  • 3,596
3 votes
1 answer
85 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 ...
3 votes
0 answers
662 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: ...
  • 3,596
3 votes
0 answers
29 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
5 votes
1 answer
40 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 ...
4 votes
1 answer
63 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
0 answers
111 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 ...
  • 3,596
1 vote
0 answers
68 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 ...
  • 3,596
1 vote
1 answer
43 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 ...
  • 3,596
1 vote
0 answers
22 views

How to code a minimization problem with constraints and indices into PSO within MATLAB? [closed]

I have a GAMS code that represent a mathematical model which depends delay (i,p) for each job i and the period of day p. So, I have indices for represent delay and objective is minimizing of summing ...
user avatar
2 votes
1 answer
131 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, ...
4 votes
0 answers
161 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 ...
2 votes
0 answers
30 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
0 answers
149 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 ...
4 votes
2 answers
103 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 ...
  • 141
2 votes
1 answer
137 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
1 answer
305 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 ...
3 votes
2 answers
58 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 ...
1 vote
0 answers
35 views

Calculating the term of dfdeta [closed]

I am trying to improve the time running of this code. Some dummies variable is defined and it is just some part of a lot of lines of code, but I tried it with dummies variables. It takes too much in ...
  • 11
2 votes
1 answer
565 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: ...
1 vote
1 answer
178 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
4 votes
1 answer
52 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 ...
2 votes
0 answers
30 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
3 votes
2 answers
72 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 ...
3 votes
3 answers
124 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 ...
4 votes
1 answer
1k 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
5 votes
1 answer
156 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 (...
3 votes
0 answers
64 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
4 votes
1 answer
724 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 ...
  • 183
2 votes
1 answer
72 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
3 votes
1 answer
397 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 ...
  • 551
4 votes
1 answer
69 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
2 votes
1 answer
97 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 ...
4 votes
1 answer
359 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
3 votes
1 answer
94 views

How to pass pre-generated values to an anonymous function to speed up a fit?

In Matlab I am using the combination of fit and fittype function (from the curve fitting toolbox) to fit a signal using an ...
  • 33