Questions about the numerical programming language MATLAB.

learn more… | top users | synonyms

0
votes
1answer
32 views

Open several dependent functions in matlab with scripting

I have several matlab functions and one script that call those functions. Suppose that they are 'a.m' 'f1.m' 'f2.m' and 'f3.m'. The script 'a.m' must open the functions files when it is manually ...
1
vote
2answers
45 views

use Matlab's PDE toolbox to solve PDE with variable coefficients [on hold]

I'm new to the PDE toolbox in Matlab. From the PDE specification window of the toolbox, it looks like one can only solve PDE with constant coefficients. How can ...
2
votes
2answers
79 views

Comparing Eigenvectors, Mathematica vs. Matlab

I am trying to create the same out puts in Mathmatica and Matlab, however I am running into trouble aligning the eigenvectors with the eigenvalues, I think the Matlab is doing something slighly more ...
0
votes
1answer
39 views

Permission denied with diary command

I am trying to use the diary function in Matlab: ...
2
votes
4answers
107 views

Open source auto-differentiation for MATLAB?

Are there any open-source auto-differentiation libraries for MATLAB? I am aware of commerical packages such as http://tomopt.com/tomlab/products/mad/ and plenty of C++ libraries, but I can't find much ...
0
votes
0answers
42 views

ode45 solver MATLAB improve time

I am numerically simulating the Mathieu equation using ODE45 and I have to keep changing the parameters delta and epsilon for each simulation to get the required peiodic solution. Following is the ...
0
votes
0answers
25 views

Generating start point in a systematic manner for fmincon

I'm trying to generate start points for my optimization problem in Matlab. At this point Im not worried about feasibility but only a fast way to generate the points from which I could test the ...
1
vote
0answers
30 views

Generating Hessian of the Lagrangian with dynamic number of nonlinear constraints in Fmincon

I'm using interior point algorithm for solving a nonlinear optimization problem and want to provide Hessian of the Lagrangian as part of fmincon to speed up the process (running couple of thousand ...
0
votes
0answers
37 views

Fast way to compute barycentric lagrange interpolation

Is there any fast way to compute the barycentric Lagrange interpolation using matlab? something more faster than using repmat instead of for loops
4
votes
1answer
59 views

Advice on numerical solution for 2D hyperbolic PDE with zero flux boundary conditions

I would like to numerically solve a hyperbolic PDE of the form $\frac{\partial\theta_t}{\partial t}(x,y)+\frac{\partial\left[\theta_t \gamma_t^x\right]}{\partial x}(x,y)+\frac{\partial\left[\theta_t ...
1
vote
1answer
43 views

How can QR iteration with complex matrices produce complex diagonal entries?

In Lapack (zhseqr) and matlab, the eigenvalues of a complex matrix are computed successfully. I notice that QR iteration or algorithm is involved with that process. QR iteration repeats to call QR ...
3
votes
2answers
54 views

Surface fitting

I do not need a complete answer but just some advice. I have a sparse matrix of points in a volume. I know a surface passing by these points exists and this surface is mostly flat and relatively ...
0
votes
0answers
22 views

Determine function parameters with neural network

I am currently studying a doctoral thesis in control theory. At the end of every chapter there is a simulation of a relative-with-the-subject problem. I have finished the theory,but for further ...
0
votes
1answer
49 views

Overcoming floating point issues when Inverse does not exist but determinant provides nonzero result

I have an expression (let's say determinant of matrix A) expressed in symbolic form in terms of 2 decision variables x1, x2 and 2 parameters q1 and q2. I'm minimizing this using fmincon for different ...
4
votes
1answer
89 views

Python: Multistart optimization using parallel programming

[I previously asked my question on StackOverflow but this site may be more appropriate] In Matlab, I am currently using the MultiStart as an optimization algo in a parallel setup for a computer ...
0
votes
1answer
108 views

Trying to understand results for anonymous function defined in two different ways

I'm trying to make my code more efficient so exploring alternatives and providing a simplified example here. Here are 3 different versions I thought of for defining an anonymous function in matlab. ...
2
votes
1answer
88 views

Calculating the Derivative using FFT in Matlab

Help! I'm trying to calculate the derivative of a function using FFT in matlab. I've coded the following function to calculate it: ...
0
votes
3answers
140 views

Looking for ways to speed up the numeric evaluation of a symbolic expression in Matlab

{Summary: I have a symbolic expression DCritnF expressed in terms of two variables x1 and x2. I need to find it's numeric value and I used combination of double and subs as given below. ...
0
votes
1answer
39 views

MatLab pde tool box:how to extract the data from the 3D plot

I'm using the Matlab pde tool box to simulate the electric field around a pointed needle.I would like to extract the electric field values at various x and y coordinate values so that I can zero in on ...
0
votes
1answer
64 views

solving underdetermined system of equations with a sparse matrix as input

I am using Matlab to solve Ax=b and my A is very large, sparse, binary and also rectangular. I saw the Matlab backlash \ operator help and it states that if A is rectangular then it will use the QR ...
0
votes
2answers
72 views

Matlab fmincon with zero user-supplied hessian

I have to solve the problem $$\min_x 1^Tx+\frac{\lambda}{2}\|\Omega\mu-x\|_2^2+\frac{\beta}{2}\|x-\bar{\gamma}\|_2^2\quad\text{w.r.t.}\quad Px-c=0,\ \ x\geq0$$ and in order to do that with Matlab I ...
0
votes
1answer
40 views

Matlab represent graphs

Is there a common / good way to represent graphs in Matlab and operate on them? I need to read in an image as a graph and use several algorithms of graph-theory like minimal cut.
1
vote
0answers
32 views

characterising attractors for master equations

I have a master equation for $(x,y,z)$ with the constraint $x+y+z=N$. $x$ can be regarded as the number of animal of a certain species in the whole system. In other words, I have a differential ...
0
votes
1answer
58 views

How to get values from the loop in MATLAB?

Could you tell me please how to obtain separate values of "pi" depending on the value of N (code below)? For example If I write "pi1" I will get a value of "pi" for N(1) where N(1)=100. If I write ...
1
vote
1answer
64 views

Self-Consistent solution of Boltzmann eqn. using Matlab

I am trying to solve Boltzmann eqn: $\frac{e}{m}\tau\vec{E}_x\cdot \nabla_\vec{v}{f(\vec{v})}=f(\vec{v})-f_0(\vec{v})$ where $f_0(v)=\exp{\frac{-m \vec{v}^2}{T}}$ and ...
0
votes
1answer
182 views

Drunken Man in Matlab

I wrote a script that plots the results of the "drunken lamppost" problem in MATLAB. Now I need to create a road-width from -3 to +3, length from 0 to infinity but the drunk can walk just ahead. It ...
1
vote
1answer
46 views

What is Precision-Recall Curve? [closed]

I have a data mining assignment where I make a content-based image retrieval system. I have 20 images of 5 animals. So in total 100 images. My code returns the 10 most relevant images to an input ...
1
vote
1answer
47 views

Is there a reference/source paper for the TUCKER_ALS() in Tensor Toolbox for MATLAB?

TUCKER_ALS computes the best rank-(R1,R2,..,Rn) approximation of tensor X, according to the specified dimensions. I am using MATLAB Tensor Toolbox Version 2.5. I am wondering if I write a paper, how ...
0
votes
2answers
131 views

Systems of nonlinear equations

Consider the nonlinear system of equations $$ (1) \quad qk^2a_1^2E^2+wna_0a_1AE+pnka_0^2a_1E+rn^2a_0^2A^2-rn^2a_0^3A^2+qk^2a_0a_1ABE-qk^2na_0^2E^2=0, $$ $$ (2) \quad ...
1
vote
1answer
79 views

System of nonlinear equations in MATLAB

I've got some problems solving (numerically) this system of equations. \begin{array}{l} 40 \cdot \cos (2t) + 105 \cdot \cos ({\theta _3}) - 75 \cdot \cos ({\theta _4}) - 91.924 \cdot \cos ({337.62}) ...
0
votes
1answer
61 views

Initial estimate of coupled variables while applying implicit euler to solve nonlinear system of odes

I am trying to solve a system of coupled odes having the following three equations. $$ \begin{align} \frac{dn_A}{dt} & = e\left[j(t) - f\, θ_H\sinh\left(\frac{g\,n_A}{T}\right)\right] \\ ...
0
votes
1answer
84 views

Gilbert-Peierls algorithm for LU Decomposition

I searched for Gilbert-Peierls algorithm, but I haven't found anything useful (well, I found this, but it's not working as it should). I think the problem is the second part, and also that those ...
2
votes
2answers
178 views

Obtaining a 2D profile from a 3D surface

I am plotting a saturation field (as the solution of a finite element problem, using trisurf in MATLAB). Ideally, I would like to obtain the two-dimensional profile ...
2
votes
2answers
56 views

Extracting time scales information from empirical cumulative distribution function

I have a stochastic process (a Markov chain actually) that has two absorbing states. I am using a difference equation to calculate the first passage time to either of the absorbing states. There are ...
9
votes
3answers
234 views

Least squares approximation question

I am taking a course on scientific computation, and we just went over least squares approximation. My question is specifically about approximating using polynomials. I understand that if you have n+1 ...
1
vote
0answers
123 views

Givens method for sparse matrix

I have a (very) large sparse matrix in CSC form and I'm supposed to factorize it. I've read that between Givens and Householder transformations, Givens is better for a sparse matrix. The problem is ...
1
vote
3answers
238 views

calculate Binomial coefficient over $2^n$ in Matlab

I want to calculate ${n \choose k}/2^n$ for moderate $n$ and $k$. In Matlab, use nchoosek(n,k) with $n=60$ and $k=30$ will give a warning: "Warning: Result may not ...
0
votes
1answer
110 views

Matlab: Error in integral function

I want to compute an integral with the following code written in Matlab. ...
1
vote
0answers
184 views

Self-consistent numerical solution of a set of equations

I am trying to solve an assignment on solving the Bogoliubov de Gennes equations self-consistently in Matlab. BdG equations in 1-Dimension are as follows:- $$\left(\begin{array}{cc} ...
1
vote
1answer
586 views

How to plot probability density function in MATLAB?

I'm trying to get a frequency plot, or PDF (probability density function) plot for my biometrics project in MATLAB. I have two vectors genuine_scores and ...
0
votes
1answer
65 views

Custom CVX Functions - Overriding Errors [closed]

I have constructed a function in Matlab that is convex and increasing (qualitatively similar to an exponential function but I am hoping to avoid the successive approximation requirement of exp). In my ...
2
votes
0answers
38 views

Spatio-temopral wavelet analysis

Am quite new to wavelet analysis and would like some help. I am performing a spatio-temporal analysis of monthly gridded rainfall data. With PCA, I can reduce the dimension of the rainfall data into a ...
6
votes
2answers
217 views

Is there any numerical reason for not using repeated multiplication instead of integer powers?

I recently discovered that, in MATLAB 2013b at least, it is significantly faster to do repeated multiplication rather than integer powers. That is, ...
2
votes
2answers
167 views

visualization of 3D probability flow

I have a master equation for $P(N_A^+,N_B^+,N_C^+,t)$, with $N_A^+,N_B^+,N_C^+$ all discrete. The numerical integration is done by this Matlab program using Euler's method. Despite the crude Euler's ...
0
votes
0answers
38 views

Boundary layer in a stream function

i've to solve numerically this equation: where: psi_y=u psi_x=-v that is the boundary layer equation in a stream function. i want to solve this equation with a direct method. which are the ...
0
votes
0answers
60 views

Exchange the position of two particles using Matlab

need to exchange the position of two particles in order to test the symmetry of the wave-function $\psi(x_1,x_2)$ using Matlab. Can anyone tell me if there is a certain command I have to use? and if ...
2
votes
1answer
136 views

Solve Regularized Least Squares problems using Matlab optimization toolbox

I am trying to solve a least squares problem where the objective function has a least squares term along with L1 and L2 norm regularization. I am unable to find which matlab function provides the ...
3
votes
0answers
112 views

Transport Equation in a Tube: Source Term on Boundary

I'm modeling mass transport in a flow reactor. The flow reactor is a tube, which allows me to use cylindrical symmetry in solving the Convection-Diffusion-Reaction (CDR) Equation, which governs the ...
3
votes
1answer
243 views

How to solve the advection equation in 2 dimension using the Crank-Nicolson method?

I've an equation like this to solve with the crank-nicolson method $$U_t -\frac{y}{2} U_x + \frac{x}{2}U_y = 0,$$ where $x$ and $y$ are: [-2,5:2,5] and the time ...