The Stack Overflow podcast is back! Listen to an interview with our new CEO.

# Questions tagged [matlab]

For mathematical questions about MATLAB; questions purely about the language, syntax, or runtime errors would likely be better received on Stack Overflow. MATLAB is a high-level language and interactive programming environment for numerical computation and visualization developed by MathWorks.

2,678 questions
Filter by
Sorted by
Tagged with
21k views

### Is Sage on the same level as Mathematica or Matlab for graph theory and graph visualization?

The context: I'm going to start working on a project that involves running predefined algorithms (and defining my own) for very big graphs (thousands of nodes). Visualization would also be welcome if ...
54k views

### How to generate random symmetric positive definite matrices using MATLAB? [closed]

Could anybody tell me how to generate random symmetric positive definite matrices using MATLAB?
3k views

### Matlab wrong cube root [closed]

How can I get MATLAB to calculate $(-1)^{1/3}$ as $-1$? Why is it giving me $0.5000 + 0.8660i$ as solution? I have same problem with $({-1\over0.1690})^{1/3}$ which should be negative.
18k views

### Implementing Ornstein–Uhlenbeck in Matlab

I am reading this article on Wikipedia, where three sample paths of different OU-processes are plotted. I would like to do the same to learn how this works, but I face troubles implementing it in ...
1k views

### A hole in the distribution of eigenvalues - is this real?

Plot the eigenvalues of many $n\times n$ real matrices in the complex plane, where the matrices are taken from a some distribution. For $n>7$, you can start to see a hole at the origin starting to ...
799 views

### What function could describe this GIF animation?

I found this image on Beautiful Mathematical GIFs Will Mesmerize You and this GIF really caught my attention. From what I see, it's a 2D circle morphing into the 3D sphere. What function could ...
47k views

### Piecewise function plot in Matlab

Is it possible in Matlab to plot an even piecewise function like: $f(x) = \begin{cases} 3t , 0 < t < \pi \\ -3t , -\pi \le t \le 0 \end{cases}$ which has a period of $2\pi$. I can'...
2k views

### What is the difference between optimal control and robust control?

What is the difference between optimal control and robust control? I know that Optimal Control have the controllers: LQR - State feedback controller LQG - State feedback observer controller LQGI - ...
4k views

1k views

### Fast algorithm for approximating Eigenvalue distribution of large sparse matrix

I am interested in the eigenvalue distribution of a huge $2^{16}$x$2^{16}$ Hermitian sparse matrix with spectrum contained in $[-1,1]$. That is I don't need to know all eigenvalues exactly, but rather ...
13k views

### Evaluate derivative of Lagrange polynomials at construction points

Assume, that we have points $x_i$ with $i=1,...,N+1$. We construct the Lagrange basis polynomials as \begin{align} L_j(x) = \prod_{k\not = j} \frac{x-x_k}{x_j-x_k} \end{align} Now according to my ...
1k views

### Matlab code to compute the smallest nonzero singular value of the matrix without using SVD

I want to compute the smallest nonzero singular value of the matrix A, which is defined as follows. Let $B = rand(500, 250)$, $A = B*B^t$, where $t$ denotes the transpose of the matrix. I found ...
5k views

### How can I write an SDE in Matlab?

My professor would like me to solve a system similar to the following: $$dx_i=[f_i(x_1,x_2,...x_n)]dt + g_ix_idW_i$$ Where $g_i$ are positive constants that measure the amplitude of the random ...
693 views

### is there a name for this function (parity of a finite sequence)?

Variants of this question have been crossposted to Stack Overflow and Computational Science Stack Exchange. Additional answers may be found at these other sites. Math people: In an attempt to solve ...
416 views

270 views

### Two Matlab ODE solvers, two different results

I am solving a system of ODEs using Matlab. One particular set of parameters caused the solver to fail, so I worked my way through the different solvers Matlab provides. I was surprised to find that ...
458 views

### Problem with an algorithm to $3$-colour the edges of cubic graphs

I'm currently trying to implement an algorithm to $3$-colour the edges of cubic graphs. (I want to do this with Matlab's Symbolic toolbox). After restricting to planar graphs to ensure the existence ...
248 views

### Using collocation method to solve a nonlinear boundary value ODE

I have the following ODE $$u'' = -(1 + e^u), \quad u(0)=0,\quad u(1)=1$$ I want the divide the interval $[0,1]$ into $n-1$ equal subintervals each with length $h=1/(n-1)$ and we take approximate ...
6k views

### How to calculate $\exp(-x)$ using Taylor series

We know that the Taylor series expansion of $e^x$ is $$e^x = \sum\limits_{i=1}^{\infty}\frac{x^{i-1}}{(i-1)!}.$$ If I have to use this formula to evaluate $e^{-20}$, how ...
8k views

### Matlab code for finding the curvature of a curve using given data points

I have data points $(x,y)$ for a plane curve, and I would like to find its curvature. While I was googling to check how could I start, I found this matlab code: ...
1k views

### How to use Newton's method to find the roots of an oscillating polynomial?

Use Newton’s method to find the roots of $32x^6 − 48x^4 + 18x^2 − 1 = 0$ accurate to within $10^{-5}$. Newton's method requires the derivative of this function, which is easy to find. Problem is, ...
7k views

### Bayesian Network for dummies

I know the Bayes Theorem but I've never heard nor used Bayesian Networks. Now I'm told to use Bayesian networks to estimate a dysfunction probability in a noisy signal with Matlab Can someone please ...
8k views

### Solving $Ax=b$ under $L_1$ $|Ax-b|$ minimization

I would like to solve a linear system $Ax = b$ under the $L_1$ norm constraint $\min(|Ax-b|)$. All that I can find about $L_1$ minimization is a way to minimize $|x|_1$ subject to $Ax=b$. I wanted to ...
8k views

### Kendall tau calculation

Can someone explain how the Kendall tau works? I can't seem to find a good explaination/tutorial/example. I've been running corr(x,y,'kendall') from Matlab's ...