Questions about the numerical programming language MATLAB.

learn more… | top users | synonyms

0
votes
0answers
3 views

CVX optimazation of convex function

max (M,p) Ctotal = max (M,p) MRTtran s.t. TCOP (M, p) +MTtran ≤ Tframe & 0 ≤ p ≤ 1 I am studying a paper and in the process I need to solve this in order to understand the concept.
1
vote
0answers
24 views

Using Centroid decomposition instead of SVD

This paper says centroid decomposition (CD) is an approximation to singular value decomposition (SVD). First I do not understand CD yet, since code is available I just want to try it out how it works ...
5
votes
2answers
107 views

Why is Matlab's SVD faster on skinny matrices than on fat matrices?

I noticed something odd today. I have a matrix X that is very skinny (20800 x 200), double precision real numbers, not sparse, ...
1
vote
2answers
71 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 ...
0
votes
0answers
47 views

parallel computatioan of a PDE in MATLAB

I want to solve a 1-D PDE $(\partial_{tt} + \alpha\partial_t)u(x,t)=\partial_{xx}u(x,t)-\sin(u(x,t))+f$, using method of lines and for this I defined a spatial grid of about n~1000 points. Since my ...
0
votes
0answers
16 views

wilcoxon signed rank test [closed]

Is it correct to test a data set of as low as 5 for a wilcoxon signed rank test for a significance value of 7%? Currently I'm using MATLAB for this test and I am getting a p=0.0625. Can I be assure ...
1
vote
2answers
80 views

How to solve ODEs with constraints using BVP4C?

I am using BVP4C to solve a system of ODEs which is as follows. \begin{equation} \left\{ \begin{aligned} \frac{\partial f(x,y)}{\partial x} &- ...
3
votes
1answer
106 views

Software for triangulating a point set (with restrictions)

I want to triangulate a point-set like the one below. I would like the triangulation of the point-set to have the following properties The triangles must have as vertices the black and orange ...
0
votes
0answers
48 views

Matlab backslash command slow on diagonal matrix

So I'm solving the system Ax=b for a random 2000x1 b. Using the tic-toc commands I timed how long A\b would take for a random diagonal A.(A=diag(rand(2000,1));) Then I perturbed the 1,2 entry of A ...
0
votes
1answer
56 views

MATLAB: Backslash operator using symbolic variables with an overdetermined system

I have an overdetermined system (too many equations), expressed as Ax=b, in MATLAB. When I try to solve it using A\b, I receive the error: ...
2
votes
0answers
64 views

1 D Diffusion equation FDM with different layers

I'm trying to solve this particular equation $\frac{\partial u}{\partial t} = \frac{\partial}{\partial x} \big[D_{i}(x)\frac{\partial u}{\partial x} \big] + S(x,t)$ where the $i$ index denotes ...
3
votes
1answer
62 views

Integration including bessel function

I’m trying to evaluate an improper integral of a 0th order Bessel function of the first kind using Matlab: v = integral(@(x)besselj(0, x), 0, Inf) which returns ...
1
vote
1answer
38 views

Is it possible to locate an image in a video using MATLab?

I'm not a huge programmer, but if it'll save me lots of time, that's when I code (given that it's possible). I know MATLab has a Computer Vision Toolbox, so my question is: is it possible to program ...
0
votes
2answers
63 views

How can I reduce integration tolerance in matlab?

It was said in a comment that I should recude integration tolerance to eps. What does this Matlab error message mean? I read the manual and I still don't know how to do it. Can you please tell me how ...
1
vote
1answer
55 views

Sparse linear system of certain type

Let $n_1,n_2 \in \mathbb{N}$ and $n=n_1n_2$ and $b\in \mathbb{R}^n$. I have a SPD-matrix $A=(a_{i,j})\in \mathbb{R}^{n \times n}$ with $a_{i,j}=0$ if $|i-j| \notin \{0,1,n_1\}$. Can we solve the ...
-1
votes
0answers
32 views

Collapse a block matrix in matlab or octave

I have a 3x3x3 block matrix i.e. mat(:,:,2) looks like [ A B; C D] Where A-D are NxNxN matrices. Id like to collapse the matrix into 27xNxN and preserve the ...
1
vote
1answer
45 views

Creating Periodic Noise in Matlab and then adding it to a signal

I am not sure if this is the correct forum for this question but here it goes. If this is not the correct forum please direct me to the appropriate forum. I wish to add some periodic noise to a 1-D ...
1
vote
0answers
49 views

Solving condensate density problem in MATLAB

I want to solve for $n_{0}$ for a fixed value of $n$, lets say $n=1$ $$ n= n_{0}+ \dfrac{1}{2}\int_{-1/2}^{1/2}dq\left(\dfrac{e_{q}+Un_{0}}{\hbar\omega}-1\right) $$ where $e_{q}=2[1-cos(2\pi q)] $ ...
0
votes
0answers
12 views

Forcing variables to take specific values in ode15s [duplicate]

I am solving a system of ODE's. Instead of using M * dC/dt = F(C,t), I would like to specify the jacobian and instead use M * dC/dt = J * C. Since the problem has Dirichlet type boundary condition, i ...
2
votes
1answer
69 views

Effect of banded matrix on error

It is necessary for me to solve a Poisson problem with a numerical method on a square domain with two types of triangular mesh: uniform triangular mesh (using uniform distribution nodes on square) and ...
0
votes
1answer
34 views

Interpolating 3D Array non-monotonic data in MatLab

I am working on creating a program for simulations where three variables are parametrized, and we modify one parameter while keeping the other two constant. An example array looks like this when ...
-1
votes
1answer
66 views

Dirichlet boundary condition

I am trying to solve ODEs in matlab using ode15s. Instead of specifying ODEs in the format M * dC/dt = f(C,t) where C is a function of x and t. I want ...
0
votes
1answer
40 views

For loops in matlab with a specific starting point

I have the following definitions long = 1000; init = 500; N = init+long; T = init+1:N-1; T1 = init+2:N; I then fill the vectors ...
0
votes
1answer
91 views

Raising elementwise a large symmetric, positive definite matrix to a power in Matlab

I have created a large positive definite (thus symmetric) matrix in Matlab. For sake of simplicity, let's assume that the matrix has the following form: $K= \left[ \begin{array}{ccc} k_{11} & ...
2
votes
1answer
49 views

find the exact solution ref The finite element method using matlab by Kwon and Bang [closed]

The results found are as under how do we find the exact solution ref The finite element method using matlab by Kwon and Bang.Page no 280-281 Example no 8.10.1.
2
votes
0answers
38 views

Bracket Algebra, Straightening Algorithm

My apologies if the question is simple. I need to write a code for straightening algorithm. Which includes defining bracket algebra. I tried to write it in CoCoA-5, but it wasn't possible because ...
0
votes
0answers
79 views

3D animation of a vector field (ParaView)

I am trying to create an animation of a 3d vector field in ParaView. All my data is in three matrices (201 x 201 x 201) corresponding to vectors components in x,y,z directions. And it's calculated in ...
4
votes
0answers
99 views

Is there a faster method to compute the geometric series of a matrix?

I want to calculate the geometric series of a matrix $A$: $$S=I+A+A^2+\dots+A^n$$ and then apply to a vector $v$, $Sv$. I've done it in Matlab with a loop and I think it's quite efficient applying ...
0
votes
0answers
39 views

How to speed up calls to integral2 in matlab

I am performing a 2D integral for each time step of a calculation. The problem is that I need to vary through all possible permutations of a1,a2 (which always ...
3
votes
1answer
61 views

Simple way to derive transpose of a vectorized operation

In a program I'm writing, I have a sub-routine that does some vectorized linear operations (specifically differentiation). Say for convenience I have defined the following inline function, which ...
0
votes
3answers
109 views

Solving a double integral in Matlab

I need to solve this integral: $M = \rho h \int_0^a \int_0^b N^2 \ dx dy$ where $N$ is defined as: $N = sin\left(\dfrac{\pi}{4}\eta +\dfrac{3\pi}{4}\right)sin\left(\dfrac{\pi}{4}\eta ...
0
votes
0answers
52 views

Calculating Conditional Expectations

I would like to compute the conditional expectation of a particular function : $E_{t}\left[ R(A_{t+1}, \eta_{t+1})\right | A_t]$ where $A_{t+1}$ and $\eta_{t+1}$ are two rv correlated to each ...
1
vote
0answers
104 views

eigs routine in octave

I am using octave and observed a problem with the eigs-routine for non symmetric matrices. Using GNU octave version 3.8.1 the code below gives significant difference of eigenvalues although same ...
0
votes
0answers
44 views

How to compute convergence rate for FVM in matlab?

I have implemented a finite volume scheme using Lax-Friedrichs flux and using Roe's linearization. I want to compute the order of convergence vs. the space-step $h$. I have computed a solution with a ...
0
votes
1answer
95 views
3
votes
2answers
172 views

Projecting Finite Element solution onto new mesh

I am implementing a finite element solver in MATLAB and I have the following problem. Let's say I have a mesh $\mathcal{T}_1$ with triangular elements on a rectangular domain ...
3
votes
2answers
77 views

Bessel EVP and fzero

I am trying to solve the Eigenvalue problem $$ x^2 y''+ x y' + x^2 y = \lambda^2 y\,,\quad x\in(0,1)\,,\quad y(0)=0\,,\quad y'(1)=y(1) $$ The differential equation is the Bessel equation. The solution ...
0
votes
1answer
80 views

Importing results of FEM analysis into Matlab

I need to import in Matlab the results (like time histories of diplacement or frequency response at a specific point) obtained from a FEM analysis in Nastran. At the moment I ask Nastran to save the ...
0
votes
1answer
172 views

Solve poisson equation with Neumann b.c. (matlab or octave)

I'm trying to reconstruct an image given its Laplacian, which results in a Poisson equation and I'm using Neumann boundary conditions (derivative at boundary = 0). What I have is the laplacian (f, ...
3
votes
2answers
309 views

Solution blows up when using Runge-Kutta to solve simultaneous ODEs for liquid film equations

This is a continuation of a problem I asked over at physics exchange and math exchange. Basically I have two ODEs that I am solving in order to calculate the radial and tangential velocity of liquid ...
1
vote
1answer
88 views

Approximate $h$ in $F(\theta)=\sin \theta \int_{-L}^{+L}h(z)e^{-ikz\cos \theta} \,dz$

Consider $$F(\theta)=\sin \theta \int_{-L}^{+L}h(z)e^{-ikz\cos \theta} \,dz$$ $$|z|\le L$$ $$0 \le \theta \le \pi$$ By having knowledge of $F(\theta)$, how can one approximate $h(z)$? In addition, I ...
0
votes
3answers
80 views

Meshing of polygons

I need to generate a sequence of increasingly denser high-quality triangular meshes for some pentagons in MATLAB. I want to supply as my input The coordinates of the 5 vertices of the pentagon ...
2
votes
2answers
186 views

How to find all roots of equation in Matlab?

How to find all roots of an equation in Matlab? I tried and it gave me just one of the roots. For example: my equation is $F(x)=0$ where ...
5
votes
0answers
62 views

Find the solution of linear equation using Wiedemann/ Krylov method

Let given $M =$ 1 0 1 0 1 1 1 1 1 and $b =$ 1 0 1 How to find the solution $x_3$ where ...
1
vote
2answers
172 views

Determine unit outward normal vector for a curve

It is necessary for me to find the unit outward normal vector for the curve: $$\gamma=(x(t),y(t)) $$ where $$x(t)=\cos(t)−0.5\cos(3t)$$ and $$y(t)=\sin(t)+\sin(7t)+\sin(3t)$$ I know how to find ...
1
vote
1answer
147 views

How to construct the matrix like this

"We consider an unstructured planar (undirected) graph and calculate the stationary probability distribution of the random walk on the graph. The graph is generated by choosing n random points in the ...
1
vote
3answers
149 views

Searching solution for solving huge linear system in MATLAB or C

I am encountering a problem that my MATLAB code ran and an error occurs and shows that it is out of memory. My code is using finite element method to solve some complicated kind of integral equation ...
0
votes
0answers
87 views

Phase retrieval via SDP (semidefinite program) of 2D test image (Matrix completion)

In SDP based phase retrieval we have intensity measurement (abs(FFT2(x))^2) of the form A(xo) = |ak,x|^2 =b^2, phase retrieval is then find x that obeys A(xo)=b The quadratic measurements can be ...
1
vote
0answers
64 views

ARPACK gives different answers from Matlab and NAG

I'm playing with ARPACK. I looked into the examples they provide, zndrv4.f illustrating the usage of the routine znaupd, in the directory of ARPACK/EXAMPLES/COMPLEX/. I also came cross NAG Fortran ...
0
votes
0answers
81 views

Eigen vector property: MATLAB 'chol' (LAPACK DSYGV) & MATLAB 'qz' (LAPACK DGGEVX)

Two Eigen algorithms return Eigen vectors with different properties: 1st algorithm, LAPACK DSYGV (the same as MATLAB eig with ...