Questions about the numerical programming language MATLAB.

learn more… | top users | synonyms

-7
votes
0answers
26 views

Anyone need expert help/consulting with advanced programming languages? [on hold]

Code Genius was started at MIT to connect programmers in the scientific community to experts of advanced languages for efficient and cost effective support. Our platform helps programmers find the ...
1
vote
0answers
25 views

fixed point iteration to find out second order non-linear diff equations

I am working on some model analysis, getting two diff equations and after I convert them into matrix form, I have equations looks like $$ [A][X]=C\times\big(\exp([B][X])-1\big), $$ where $C$ is a ...
1
vote
0answers
44 views

Finite Difference Method for an ODE with Neumann and Robin boundary condition

Consider the following bvp: $-u''(x)+3u'(x)+u(x)=f(x) \quad in\quad \Omega=[0,1]$ $u'(0)=\alpha$ $u'(1)+2u(1)=\beta$ I have a Neumann at $x = 0$ and a Robin condition at $x = 1$. I refer to the ...
0
votes
1answer
28 views

How to represent a binary number in a matrix in Matlab?

This is a fairly simple question but my Matlab knowledge is still very limited. I want to take a given binary number (or rather, a bistring) of length $mn$ and generate an $m \times n$ matrix whose ...
0
votes
1answer
25 views

CPLEX in MATLAB - Asking for Help

I am using CPLEX in MATLAB. I want to optimize the following function $$\begin{align} &\min \Vert y\Vert\\ &\Vert y\Vert = \sum |y|\\ &\text{subject to } A y = 2B - A\, 13n \end{align}$$ ...
0
votes
1answer
28 views

Interpolation of Data Value using Optimized Weighting of Its Features

Assume I have a data set $ { \left\{ {x}_{i} \right\} }_{i = 1}^{N} $ which represents the value of each data point. For each data we have its features $ {f}_{i} \in {\mathbb{R}}^{d} $. The model I ...
1
vote
2answers
49 views

Arranging variable ranges into a cell MATLAB

I have the following simple code v=[]; for i=10:-1:1 for j=0:0.2:5 v(end+1)=i+j; end end min(v) It returns the minimum of vector $v$ whose length in this ...
3
votes
1answer
55 views

Is there an efficient $O(n^2)$ way to estimate in MATLAB a matrix condition number given its LDL decomposition?

Since evaluating a matrix condition number usually takes $O(n^3)$, I wonder whether there is an efficient $O(n^2)$ way to estimate in MATLAB a matrix condition number given its LDL decomposition. ...
2
votes
2answers
92 views

High computational time in using backslash for soving sparse matrix

I built a sparse matrix A at each step as follows: % 1 < DX < 120000 A = sparse(i,j,s,DX,DX,6*DX) b = (1, DX) The ...
3
votes
0answers
106 views

C60 orbital calculation

I am currently trying to reproduce the results published by Hands et al.1 using MATLAB. They calculated the bases of the C60 wave functions of HOMO, LUMO and LUMO+1. I did the following: I ...
7
votes
1answer
329 views

What is the numerical difference between abs(z)^2 and z x z*, where z is a complex number

I am doing research in electromagnetics (a branch of physics) and I deal with complex numbers in my computing tasks (I use MATLAB). Let's say $z$ is a complex number. To calculate the square of the ...
2
votes
2answers
76 views

SVD of large block-hankel matrix

I am trying to do SVD of a large block-hankel matrix for model order reduction (Low rank approximation). However, I quickly run into memory issues in forming the large Block-Hankel matrix and CPU ...
1
vote
0answers
37 views

1D fit on a surface in matlab

I have a problem fitting a $N\times N$ ($32\times 32$ in this case) matrix in Matlab. Here is the deal I have this image, and I want to create 1 dimensional fit between the points and then be able ...
1
vote
1answer
47 views

Multi-dimensional array reshaping Matlab

I have created a 4-dimensional array (cell) of arrays called "a" where a{i,j,k,l} = [ v_1 v_2 v_3 v_4] for some vector v. each of the index variables runs from 1 to 10 in steps of 1. I have a total ...
1
vote
1answer
64 views

Fast algorithms for computing only the generalized singular values (but not the vectors)

I am interested in computing only the generalized singular values, and was wondering if this was faster (and by how much?) than computing the full GSVD. In particular, I was wondering what the ...
0
votes
1answer
65 views

Curve Fitting problem MATLAB

I have a system of differential equations with some unknown parameters and I need to find the optimal parameter set that fits best with the data I have. For each parameter set choice (using for ...
-1
votes
1answer
205 views

How to initiate spirals in this model?

I am trying to reproduce Tang & Othmer paper which is related to excitations and oscillations in G-protein model in Dictyostelium discoideum, an amoeba species. The mathematical model in the paper ...
0
votes
0answers
19 views

Feedforward net lagged prediction [duplicate]

I am trying to predict y(t+1) of a function by using a feedforward neural network with Matlab. The inputs are the previous 3 previous values (y(t-2), y(t-1), y(t)) and the training output is the ...
3
votes
2answers
137 views

1D inhomogeneous Poisson PDE with Dirichlet BCs, slow convergence

For an assignment I have to implement a 1D Poisson PDE with inhomogeneous Dirichlet BC's $$\Delta_1 u = f, \quad u(a)=g(a), \: u(b) = g(b) $$ I have managed to make it work, but I am not seeing the ...
1
vote
0answers
38 views

Nonlinear 2D modeling of Neural Electromagnetic field in Matlab

I am trying to replicate the MATLAB simulation presented in this paper. More specifically, I have to code the solution to this equation $$\frac{a}{2R_i}\frac{\partial^2 V_m}{\partial x^2} - ...
0
votes
0answers
27 views

Matlab pde toolbox manipulate FEMesh object

Is there a possibility to write data to a FEMesh object? What I am looking for is an analogue to the MeshToPet method, something like a PetToMesh function. Any other way to manipulate the nodes in a ...
1
vote
0answers
55 views

Simple MCMC Algorithm in Matlab

I would be really glad to get some specific advise on how to implement a simple MCMC algorithm (in Matlab, if possible). I'm not yet too familiar with optimization methods. My problem goes as follows: ...
1
vote
2answers
116 views

How can I prove that two eigenvectors are orthogonal?

I obtained 6 eigenpairs of a matrix using eigs of Matlab. How can I demonstrate that these eigenvectors are orthogonal to each other? I am almost sure that I ...
-1
votes
1answer
61 views

Is iteration an efficient algorithm in this case? [closed]

My task in numerical analysis is We are interested in finding values of β0 for which z(x) = 2500. Use an efficient algorithm to determine the rays which pass through the receiver. Now I'm ...
1
vote
1answer
39 views

Assigning values to different regions in matlab

I am facing a problem as follows: I have created a Voronoi diagram and now I want to assign to each region, a value, i.e., I want to extend this Voronoi diagram to form a 2 variable function in ...
1
vote
0answers
68 views

Arpack and Matlab give different values for eigenvalues

I am solving a generalized eigenvalues problem with inversed complex shift: $$(M-\sigma J)^{-1}J \boldsymbol{x} = \boldsymbol{x} \nu \enspace .$$ My matrices are obtained from a finite element ...
1
vote
1answer
36 views

How to nest 2 simple CVX problems? Is it possible at all?

I have the underdetermined outer optimization problem $$\text{min}_{x\geq 0}\quad \|Ax-b_1\|_2^2+\|AT(x)-b_2\|_2^2$$ with $A\in\mathbb{R}^{m\times n}$ and $m<<n=64^2$ or in corresponding CVX ...
1
vote
1answer
52 views

Satisfying Periodic Boundary Conditions while plotting spherical particles inside a cube

I am trying to plot spherical particles in a cube of fixed dimension in matlab. I face a problem here where the center of the sphere is too close to the edge of the cube in this case the rest of the ...
0
votes
0answers
70 views

Integration in MATLAB: Complicated integrand

Can I solve the integral given below using Matlab? $$\frac{C(J)}{C_0} = \frac{2e^J}{\pi}\int\limits_{0}^{\infty} \frac{e^{\frac{\gamma}{2}\left[1 - \sqrt{\rho}\cos(\theta/2)\right]}}{a_1^2 + a_2^2} ...
1
vote
0answers
33 views

radially averaged power spectrum of a binary image does not look like power law

It has been known that Fourier power spectrum somehow obeys power law therefore the slope of the spectrum can be used to calculate the fractal dimension of an image. Many people have used it for ...
0
votes
1answer
91 views

Use line segments to approximate a function

I need to use line segments to approximate a function, f = 1/x. The range of x is from 1 to 2048 with an interval of 1. I will pick 10 locations for x and interpolate y between two adjacent x using ...
0
votes
0answers
107 views

MATLAB: code for restarted gmres

I have a question about Matlab and restarted gmres. I would like to use gmres.m provided here. This code seems to be a popular for the scientific computation ...
1
vote
3answers
105 views

Dealing with errors in non-linear least square problem

I am currently working with a optimization problem involving a non-linear least square problem. I have chosen to use lsqnonlin in Matlab. What follows is a ...
0
votes
0answers
86 views

Frank Wolfe algorithm in matlab

I'm trying to solve the following question : $$ maximize \ x^{2}-5\cdot x + y^{2}-3\cdot y $$ $$ x+y\leq 8 $$ $$ x\leq2 $$ $$ x,y\geqslant 0 $$ By using Frank Wolf algorithm ( according to ...
1
vote
1answer
46 views

Why does `symrcm` create larger band width?

When I run the following (in Matlab) on a sparse matrix $A$, I get larger band width. The symrcm (symmetric reverse Cuthill-McKee permutation) is not guarenteed to ...
0
votes
0answers
34 views

Matlab PDE toolbox

I'm new at matlab and I can't figure out how to make external temperature not constant but as a function. I wanted to use pde toolbox, I choose parabolic type. My external temperature should be ...
3
votes
0answers
69 views

2D wave equation with Mur boundary condition - setting up the RHS and solving (time-steps)

I am trying to solve a 2D wave equation implicitly using FD with central approximations with the following boundary conditions $$\begin{align} &u=2\sin\left(\frac{2\pi}{5}t\right)\quad \text{at ...
1
vote
1answer
124 views

Instability of pdepe in Matlab… boundary conditions?

here is a Matlab beginner banging his head on the wall... I am trying to solve a system of partial differential equations in Matlab, with both derivatives in time and space domains. I am using the ...
0
votes
1answer
99 views

Solving a PDE using Matlab (with varying initial conditions)

I want to solve a 1-D heat conduction PDE using Matlab which looks like $$ \rho c_p \dfrac{\partial T}{\partial t} = \dfrac{\partial}{\partial z}\left( \lambda \dfrac{\partial T}{\partial z} \right), ...
0
votes
2answers
95 views

Compute the intersection of convex sets in Matlab

I'm aware of a Matlab function which take a set of point as an input and select the points which compose the convex hull. Exemples from Mathworks website : ...
0
votes
0answers
41 views

Could anyone help me with dde23 function

I have been trying to graph these equations using dde23 but keep having a error. This is very important for my presentation so I would really appreciate any help ...
0
votes
0answers
65 views

How to solve a nonlinear diffusion equation?

Consider a thin film with a perpendicular applied magnetic field Ha in z-axis. The nonlocal relation between Ha, the self-field Hself (generated by the eddy current J) and the local magnetic flux ...
1
vote
1answer
103 views

Simple integration in Matlab is off

This is an incredibly mundane integration, but for some reason I can't spot the error. I am just performing a simple 3d integration in spherical coordinates which should return the value of 1.0: ...
1
vote
0answers
81 views

Calculate Integral Using Gauss Jacobi Quadrature or otherwise

I need to integrate the following integral: \begin{align} I = \int^z\frac{1-\zeta^2}{(1+\zeta^2)(\zeta-\zeta_l)(1-\zeta_l\zeta)}\prod_{k=2}^{n-1}\left ( \frac{\zeta-z_k}{1-\zeta z_k} \right ...
0
votes
1answer
133 views

Solving PDE with state and time 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$ ...
-1
votes
1answer
45 views

How do I stop negative numbers and error message: " Failure at t=3.562559e+03. Unable to meet integration tolerances

I am using 8 ODEs in Matlab to simulate the effect of asymptomatic infections in the epidemiology of a vector borne disease. Searching the parameter space under certain settings produces negative ...
0
votes
1answer
140 views

How to speed up fmincon in MATLAB when there are many variables? Alternatives to MATLAB optimization toolbox?

I need to solve an optimization problem with two nonlinear equality constraints. My function evaluation is very fast (less than a second) and I also provide fmincon ...
1
vote
1answer
63 views

How can I plot the Ramachandran regions in MatLab?

I have a scatter plot where I need to shade the Ramachandran allowed regions for aminoacids. I know there is a function that plots them for you, but it is not helpful for my case since I need the ...
0
votes
0answers
98 views

Plane Wave expansion method in matlab

I am a new member of this forum and I was trying to understand Plane Wave expansion simulation in Matlab. So far I cannot understand how to simulate Gz vector in K-space consistently to the numbers of ...
1
vote
0answers
43 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 ...