Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

8
votes
0answers
397 views

Fixed point iteration to find root of Arctan

I am trying to find the root of $f(x)=\arctan(x)$ by using successive iteration. There are some conditions to apply this in successive iteration . 1) The function has to be continuous. 2) $\sup|f'(...
7
votes
0answers
260 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 ...
7
votes
0answers
455 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 ...
4
votes
0answers
57 views

Solve issue with Matlab 2018b version

I was very successfully solving an equation numerically in Matlab R2014a with the following code ...
4
votes
0answers
50 views

Stiffness of a system of differential equations

For a university assignment I've been given three systems of differential equations: $$\bf{\dot{y}} = \begin{pmatrix}-2 & 1\\ 1 & -2\end{pmatrix} * \bf{y} + \begin{pmatrix}2 * \sin(t)\\ 2*(\...
4
votes
0answers
89 views

Pseudo-inverse with minimal number of non-zero entries

I'm looking for a way to compute the pseudo-inverse of a matrix (not the Moore-Penrose, but any other) with the minimal number of non-zero entries (maximum number of zero entries). In MATLAB, the the ...
4
votes
0answers
5k views

Checking positive semidefiniteness in MATLAB

Let $\mathbf{A}$ be a $n\times n$ matrix. I want to check in MATLAB if it is PSD or not. Which tests, in MATLAB, should I do for this purpose? I know that if $\mathbf{A}$ is PSD then following holds ...
4
votes
0answers
51 views

Estimating the parameters of stochastic asset price models using Matlab

I am simulating asset prices using different existing stochastic models, as well as my own proposed stochastic models. I would like to estimate the parameters of each model using the historical spot ...
4
votes
0answers
183 views

Matlab's dwt2 in publication quality notation?

I used Matlab's dwt2in my algorithm, what notation have you folks seen that describes the 4 resulting wavelets? How do I express ...
4
votes
0answers
700 views

Symbolic summation MATLAB

Can someone help me generate the following symbolic summation in MATLAB? I then want to differentiate the Jacobian matrix. $f(x) = \sum_{i=1}^{n} \sum_{j=1}^n (x_i (\Sigma x)_i - x_j (\Sigma x)_j)^...
4
votes
0answers
948 views

How to avoid numerical overflow while computing a sum of products?

Suppose we have $N$ vectors $\vec{x}_1, \vec{x}_2,\dots,\vec{x}_N$. $\vec{x}_i$ is a $M$-dimensional vector: $\vec{x}_i = \left[ x_{i1}\;\; x_{i2}\;\; \dots \;\;x_{iM}\right]^T$ with all $x_{ij}>0$....
3
votes
0answers
62 views

Simulation of irrational numbers

I am trying to write an algorithm that generates two random numbers $x_1$ and $x_2$ in a given range such that their ratio $x_1/x_2$ is an irrational number. I understand that all numbers stored on a ...
3
votes
0answers
26 views

How to find eigenvalue trajectories under perturbation

Let $A$ be an $n\times n$ diagonalizable matrix, and given a $n \times n$ perturbation matrix $P$. The perturbed matrix $$ B(t) = A + tP, $$ where $t$ evolves in small steps from 0 to 1. I would ...
3
votes
0answers
55 views

How to deal with the non-uniqueness of SVD in numerical applications?

There are many applications in applied mathematics where the SVD of a matrix comes in handy. For example, consider the problem where we want to find an approximate solution to a(n) (overdetermined) ...
3
votes
0answers
44 views

Deciding the parameter value in a ODE system

I am working with a system that includes pharmacokinetic and pharmacodynamic elements. To model the antibiotic effect on bacteria I am using a commonly used Hill type function as,${(\phi_{max} - \phi ...
3
votes
0answers
74 views

Fun PDEs and exact solutions

I am building an PDE solver and would like some PDEs to test it on. However to test it works I want to compare it to exact solutions but I'm not having much luck finding these online. I currently have ...
3
votes
0answers
81 views

Identify a state space model from measured inputs and outputs

I'm using subspace identification to identify a black-box state space model. To identify I follow these steps: We have measured a vector of inputs $u_k \in \Re^{m}$ and outputs $y_k \in \Re^{l}$. For ...
3
votes
0answers
271 views

Initial Contour in Level-Set-Method

I am learning Level-Set-Method for the image segmentation. I have a simple question, how people draw the initial contour in the given image, when people need to deform it? Is there a command in ...
3
votes
0answers
146 views

Condition number of preconditioned regularization problem involving Kronecker Product

Situation I have some results from applying right-preconditioned CGLS to the damped normal equations $(A^TA + \alpha^2I)\ \mathbf{x}=A^T\mathbf{b}$. I'm trying to find the condition numbers of the ...
3
votes
0answers
537 views

Unconstrained optimization algorithm

I need to test some Unconstrained optimization algorithms on the Rosenbrock's banana function so that I can compare the performances of those algorithms. Now, I have several resources in my hand, (...
3
votes
0answers
284 views

Euler-Maruyama to solve SDE and show strong and weak convergence

$dX_t = aX_tdt + bX_tdW_t$, $X_0 = x$ is the question and the solution for this is $X_t = xexp{(a-\frac{b^2}{2})t+bW_t}$ a and b are positive constant numbers ...
3
votes
0answers
307 views

Algorithm of LAPACK's banded solver

I was trying to convert a MATLAB program to C program and i came across a problem where i got stuck. My Matlab program has an equation of the form 'A \ B', where '\' is mldivide in MATLAB. Matrix 'A' =...
3
votes
0answers
110 views

How to decompose a 2d shape into sin and cosin modes?

Assume that you have a circle with radius $r_0$, then you keep adding cosine modes as below: $r=r_0+a_1\cos(1\theta)+a_2\cos(2\theta)+a_3\cos(3\theta)+a_4\cos(4\theta)+~...$ if you plot this as ...
3
votes
0answers
211 views

solving PDE with state-dependent boundary conditions

I am interested in solving the following PDE (heat equation): $$\frac{\partial u}{\partial t} = \kappa \frac{\partial ^2 u}{\partial x^2}$$ In order to solve it, I discretize space uniformly into $N$ ...
3
votes
0answers
172 views

Any smart tricks to simplify my nasty integration?

I am trying to solve for the following unpleasant integral $$\int_{\gamma}^{\infty} \bigg[t- \int_{-2}^{2}\frac{ t \ f_X(x)}{1+N \ \big|G(x)\big|^2 \ t^{-3}}\ dx\bigg] \ dt$$ where $N$ is a non-...
3
votes
0answers
255 views

Algorithm to find the “optimal” path in a given graph

Assume that $G=(V,E)$ is an undirected connected graph and that $H: V \to \mathbb R$ is a function that assign at each vertex $v \in V$ its height $H(v)$. Think of the pair $(G,H)$ as an energy ...
3
votes
0answers
67 views

what is the significance of Eigen values of autocorrelation matrix?

I am trying to find auto correlation matrix of an image to get Harris corners.Paper I am referring suggest that if eigen values of auto correlation matrix are large the point will be corner point.so ...
3
votes
0answers
199 views

How can I find a tranformation matrix/Mathematical relation between two 5th degree polynomial curves in space?

I have the equation of two 5th degree polynomials which they don`t intersect with each other .Each curve is made of 100 points and these two curves looks similar but there are small differences .I am ...
3
votes
0answers
1k views

The definition and meaning of “machine epsilon” in MATLAB

I am taking a introductory course in numerical mathematics, using MATLAB and a numerical math text that refers to MATLAB often. In the text, the machine precision is defined as: The distance $\...
3
votes
0answers
861 views

Compute eigenvector using given eigenvalue

I have a fairly small matrix (cca 100x100). I have computed first four largest eigenvalues (with modified Lanczsos and Lanczsos with reorthogonalization). I know this might be a rather dumb question, ...
3
votes
0answers
337 views

Is there a way to configure MATLAB's plotchar function to other sizes?

plotchar plots a 35 element vector as a 5x7 grid. Is there a way to plot other grid sizes characteres?
3
votes
0answers
418 views

Iterative solver for the pseudo inverse

I have got the following equation: $\begin{bmatrix} \hat{c}\\ \hat{\lambda} \end{bmatrix}=\begin{bmatrix} B^T \cdot B & H^T\\ H & 0 \end{bmatrix}^+\begin{bmatrix} B^T \cdot Y\\ 0 \end{...
3
votes
0answers
402 views

Interpretation of MATLAB's NaiveBayses 'posterior' function

After we created a Naive Bayes classifier object nb (say, with multivariate multinomial (mvmn) distribution), we can call ...
3
votes
0answers
485 views

Understanding Fourier Transform and FFT

First off, I'm sorry if this is a repost. I am currently writing my thesis, and I've been thrown into some Fourier analysis, which I know nothing of. So, even if this question has been posted before, ...
2
votes
0answers
29 views

How to calculate reletive weights (alpha) in Principal Component Analysis

I am trying to work through the method described in this paper of calculating a normalcy index using principal component analysis. I understand steps 1-5, except for the equation for eigenvectors ...
2
votes
0answers
54 views

Solving numerically a strongly stiff nonlinear ODE system with ill-conditioned Jacobian

Using Matlab, I am trying to solve numerically the following nonlinear system of ODEs: $$\begin{aligned} \dot B &= -\alpha B -\nu BV \\ \dot X &= A-\mu_1 X -c E(B)VX \\ \dot Y &= ...
2
votes
0answers
19 views

Scaling behavior Levy flight (distance from the origin v number of steps)

In the question Numerical approximation of Levy Flight the implementation of a Levy-flight random walk with Matlab was discussed. For a classical random walk (Brownian motion), we have that the ...
2
votes
0answers
59 views

How to solve this linear system in Matlab?

I'm trying to solve the following linear system and I'd like to do it via software to make sure the answer is correct. I'm looking for the transfer functions $\dfrac{i_L(s)}{d(s)}$ and $\dfrac{v_o(s)}...
2
votes
0answers
35 views

Fast, vectorisable distance from points to ellipse

I am writing a program im Matlab to find ellipses in noisy XY data using a Random Sampling Consensus (RANSAC) algorithm. It basically samples enough points to define an ellipse and then determines the ...
2
votes
0answers
184 views

Integrate $\int_{0}^{\infty }e^{-\lambda\pi\big( k_1(r) + k_2(r) -k_3(r)\big)}f(r)dr$

This is my Matlab code for the above function. Am I missing something? ...
2
votes
0answers
37 views

How to use numerical solution in differential equation?

I have numerical solution for variable $p$ (as series of numbers), which I got through ode45 method in MAtlab. I need to calculate $u$, where $$u=\dfrac{r^2-1}{16}\dfrac{dp}{dz}$$ May I use my ...
2
votes
0answers
93 views

Improving bad fit for data using Matlab

I am trying to fit some data to estimate model parameters in a system of 5 ODEs. I cannot get a good fit. First I tried using Matlab lsqcurvefit and I get a very ...
2
votes
0answers
92 views

Comparing analytical Fourier transform with FFTs

This is related to my other question on Stackoverflow. From using the tables on Wikipedia or Mathematica I can prove that the Fourier transform of function $$f(t) = -i H(t) \exp(-(ia+b)t),$$ where $H$...
2
votes
0answers
28 views

Scaling differentiation matrices

I have been using differentiation matrices to approximate solutions. However my matrices are defined on $x\in[a,b]$ which varies between $[-1,1], [0, 1], [-\pi,\pi]$ for different equations and which ...
2
votes
0answers
61 views

Absolute Stability- Plot

Plot the region of absolute stability of the method $y_{n+2}-y_n=\frac{1}{2}h(f_{n+1}+3f_n)$ where $f_n=(y_n,t_n)$. The only thing I can think of to do is absolute stability with the test equation, ...
2
votes
0answers
42 views

How to derive a diffusion tensor and stationary states given a Markov process transition matrix?

Let the transition matrix $P_{ij}$ represents the probability to move from state $i$ to state $j$. Now I would like to derive the diffusion tensor for this Markov process. Since I am not sure how ...
2
votes
0answers
428 views

What is the correct way to add process noise nad ODE45 solver for continous system (Matlab)

In the tutorial, when white noise process is added to ordinary differential equations (ODE), the ODE becomes stochastic process. Then the stochastic process needs to be solved using Euler Maruyama ...
2
votes
0answers
31 views

Open source solver for continuous-time non-linear stochastic DAEs (SDAEs)

I am trying to solve a system of non-linear index-1 DAEs in which the derivatives of the state variables, $x(t)$ are corrupted by additive noise, $w(t)$ (whose co-variance matrix is known). $\dot x(t)...
2
votes
0answers
43 views

Wedderburn Decomposition of Matrix Algebras in MATLAB/Octave

Is there a MATLAB/Octave function/package that, given a subalgebra of matrices, will calculate the Wedderburn decomposition? That is, it will output a unitarily equivalent block diagonal form of the ...
2
votes
0answers
109 views

Dealing with large kernel matrix in SVM, Matlab

I have a matrix X, size 40x60000 while writing the SVM, I need to form a linear kernel: $K = X^TX$ And of course I would get an error "Requested 60000x60000 (26.8GB) array exceeds maximum array size ...