Questions tagged [matlab]

Questions about the numerical programming language MATLAB.

611 questions
29k views

How does the MATLAB backslash operator solve $Ax=b$ for square matrices?

I was comparing a few of my codes to "stock" MATLAB codes. I am surprised at the results. I ran a sample code (Sparse Matrix) ...
8k views

5k views

MATLAB matrix multiplication (the best computational approach)

I have to make a coordinates transformation between two reference systems (axes). For that, three matrices ($3\times3$) have to be multiplied due to some intermediate axes being used. I have thought ...
14k views

Matlab : Is there a way to programatically safely halt code execution (like FORTRAN's stop)? [closed]

Like the title says, I want to be able to stop the code at a specific location and have it halt safely. I cannot find a command to do it like for example in FORTRAN there is the stop command.
13k views

in matlab, what differences are between linsolve and mldivide?

in matlab, both linsolve and mldivide are used for solving a system of linear equations, in all of determined, overdetermined and underdetermined cases. Reading their documents, I was wondering what ...
1k views

Optimal transport warping implementation in Matlab

I am implementing the paper "Optimal Mass Transport for Registration and Warping", my goal being to put it online as I just cannot find any eulerian mass transportation code online and this would be ...
1k views

Soft Question: Where does Python fit into the picture?

So I've been debating whether or not I should bother learning Python. From speaking with my professors, Matlab seems to be the common language used in applied mathematics/computational science as far ...
484 views

Hosting site for a small scientific library

For my research work I have been developing a small C++ library aimed at facilitating the communication between C++ computational codes and Octave/Matlab (when the latter is used for post-processing ...
205 views

Numerical stability of higher order Zernike polynomials

I'm trying to calculate higher order (e.g., m=0, n=46) Zernike moments for some image. However, I'm running into a problem ...
306 views

Can my project survive without Object Orientation?

I am writing a small MATLAB package which will solve a certain class numerical problems. There are 3 stages of the algorithm and the user has 5 choices for each stage. I have implemented the entire ...
6k views

How to approximate the condition number of a large matrix?

How do I approximate the condition number of a large matrix $G$, if $G$ is a combination of Fourier transforms $F$ (non-uniform or uniform), finite differences $R$, and diagonal matrices $S$? The ...
492 views

Matrix Balancing Algorithm

I have been writing a control system toolbox from scratch and purely in Python3 (shameless plug : harold ). From my past research, I have always complaints about ...
744 views

Matlab Pde Toolbox: Plot solution on a line or on a submanifold

I'm using the Matlab pde toolbox to solve a certain elliptic equation in 2D. Solution is fine, although I do need to plot it along a given line, i.e. to cut a planar slice from the 3D mesh ...
1k views

How to find Lyapunov exponent for coupled system

Answer gives a software for calculating conditional Lyapunov exponent (CLE) for coupled oscillators in chaos synchronization. However, it is hard to follow and there is no graphical output of the ...
3k views

Incremental SVD implementation in MATLAB

Is there any library/toolbox which has implementation of incremental SVD in MATLAB. I have implemented this paper, it is fast but does not work well. I tried this but in this also error propagates ...
2k views

Scientific Programming on Mac using Objective-C/Cocoa for MATLAB Users

I want to get started on scientific programming on the Mac using Objective-C. I am very familiar with MATLAB which makes it easy to store complex-valued waveform data in vectors and generating plots. ...
571 views

How many Fourier magnitudes do I have to calculate before an FFT becomes more efficient than a DFT?

I need to compute only a small number of low frequency Fourier components of a complex 2-dimensional array. I'll be computing the same Fourier components over and over again as the input array changes....
5k views

How to use Lanczos method to compute eigenvalues and eigenvectors

I have a sparse and symmetric matrix A(n x n). The method Lanczos tranforms matrix A into tridiagonal and symmetric matrix T and the Lanczos vectors in matrix V. From there how do I compute k ...
1k views

Compute smallest eigenvectors of a matrix

It appears that matlab's eigs is giving me bad approximations of the smallest eigenvectors of a matrix. I assume I can use some slower methods which would also be ...
177 views

How to recreate this result (from a book)?

The result I'm interested in is found within "Synchronization: A Universal Concept in Nonlinear Sciences" page $333$ figure $14.3$. The peculiar fragment is also provided at the end of this post. So ...
4k views

142 views

Tucker factorisation to compare multiple PCA decompositions?

This is an entry-level question for multiway matrix decompositions. I have a set/population $k$ of entities (here biological cells) for each of which I also have a number ($l$) of flavours of length \$...
459 views

Matrix multiplication accuracy Matlab vs Python

I am translating some Matlab code into Python and I having some problems regarding matrix multiplication accuracy. Assuming we have following data: ...
2k views

What other method can be used to solve differential equations except ode functions in Matlab?

Recently I am taking advantage of the ode45, as well as ode23s, ode15s solvers in ...
195 views

In Matlab, how can I be consistent with units?

I am modeling some aerodynamics equations and am using meters / centimeters, kilograms, and seconds. I've heard that, "matlab doesn't know units". So, how can I make sure that it does? Just ...