# Questions tagged [matlab]

Questions about the numerical programming language MATLAB.

835 questions
Filter by
Sorted by
Tagged with
45 views

### 1D FDTD simulation of plane wave propagation and the Courant stability condition

I'm currently trying to simulate a simple case of wave propagation in free space before adding in more complexities, and already I'm stumped. I understand the Courant stability condition. However, I ...
134 views

### Is there any matlab built-in function or libraries to calculate $\frac{d(\ln A)}{dA}$?

we can first conduct spectral decomposition of an positive definite isotropic tensor $A$ and then we can define $\ln(A)$, then we can define the frechet derivative of it, but how to calculate this in ...
• 191
58 views

### 2D cavity flow: Adding zero Dirichlet condition to the top boundary leads to NAN

I am following this guide to create a simple cfd solver for incompressible 2D fluid in a square cavity. The following Matlab code sample from the guide creates a Laplacian (coefficient) matrix with ...
• 21
38 views

### A plane or surface passing through two surfaces in MATLAB

I have just been able to plot several surfaces using the code below. What I want is a plane or a surface that connects the black and yellow region in the output of the code below: ...
• 111
68 views

• 33
175 views

### How do I use pdepe for a first order parabolic PDE with only one boundary condition?

I am trying to use Matlab's pdepe.m to solve the first order parabolic PDE $$\frac{\partial u}{\partial x}+\frac{\partial u}{\partial x}=x$$ I have not had trouble coding the argument of pdepe @pdefun:...
175 views

### Eigenvalues of diagonal plus rank-one

I need to compute an eigendecomposition of an $n\times n$ matrix $$D + c vv^\top = Q\Lambda Q^\top \tag{1}$$ in MATLAB, where $D$ is a real diagonal matrix, $c$ is a scalar, and $v$ is a real vector....
• 380
1 vote
43 views

236 views

### How to speed up sparse matrix index operation in Matlab?

I need to create spare matrices with variable elements. Unfortunately, sparse matrix index operations are very slow. Is there any way to speed up the process? Maybe there are some tricks that I don't ...
• 21
65 views

### Numerical solution of PDE with uniform initial condition

I have a PDE like this $$\frac{\partial h}{\partial t} = \bigg(\frac{\dot{L}}{L}\bigg)x\frac{\partial h}{\partial x} - \alpha\bigg[h^3\frac{\partial^3 h}{\partial x^3}\bigg]$$ With boundary and ...
• 73
1 vote