Questions about the numerical programming language MATLAB.

learn more… | top users | synonyms

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
104 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
32 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
22 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
113 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
58 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
60 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
31 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
45 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
25 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
76 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
95 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
100 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
73 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
42 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
33 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
58 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
95 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
91 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
78 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
40 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
57 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
101 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
74 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
118 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
43 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
117 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
59 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
87 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
39 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
174 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
152 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
84 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 ...
1
vote
2answers
161 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
140 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
1answer
82 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
97 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
83 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
45 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
256 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
59 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
vote
1answer
106 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
51 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
14 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 ...
5
votes
2answers
180 views

Why do structured and unstructured discretizations give different errors?

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
61 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
91 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 ...