# Questions tagged [matlab]

Questions about the numerical programming language MATLAB.

762 questions
Filter by
Sorted by
Tagged with
343 views

### ode45 usage in this case?

The background is that I'm solving a problem in numerical analysis and I seem to be halfway having solved the non-linear system and now getting to the part where I should apply solving differential ...
6k views

### Machine epsilon (eps)

The wiki for machine epsilon says: "Machine epsilon gives an upper bound on the relative error due to rounding in floating point arithmetic" If machine epsilon is the upper bound on the relative ...
2k views

### Integration of matrix-valued function using MATLAB

I need to compute the integral $\int_{\mathbb{R}^3}f(x)\, dx$, where $f$ is a matrix-valued function $f:\mathbb{R}^3\to\mathbb{R}^{3\times 3}$. How do I do that using MATLAB? The function $f$ is ...
3k views

### Autocorrelation problems

I have written some code, to produce some data. In what I have shown below, the output is just one-dimensional array of numbers. I have an analytical expression for what the autocorrelation function ...
1k views

### matlab eigs: wrong eigenvalues for tridiagonal matrix

I try to compute eigenvalues of the tridiagonal matrix coming from finite difference scheme. For small mesh size, eigs works well. But for large size it fails. Here is an example where eigs fails. Is ...
508 views

### matlab find element with diff equals to zero

I have X as a 616 x 1 double. I calculated the differences between adjacent elements of X by using: Y=diff(X); and get Y as a 615 x 1 double, containing positive ...
7k views

### MATLAB Subscript indices must either be real positive integers or logicals

I have a n x 3 double containing x, y and z coordinates. Can someone tell me where did I go wrong? store_y_temp=real(Y(Y>Iy)); store_z_temp=Z(store_y_temp); ...
2k views

### How do I solve a boundary value ODE in MATLAB?

Specifically, ode15i. I have ode15i solving a system of 5 first order implicit odes in 5 variables with an initial condition (made consistent by decic). It's great for what I need, except I need to ...
3k views

### Export mesh and solution from pdetool

I need to run the pdetool analysis several times for different values of pde coefficients. Repeating this procedure for different meshes is not convenient using the pdetool GUI. Is there a way to ...
108 views

### Can I use the Matlab Parallel Computing Toolbox with 64 bit linux (using Matlab R2012b)? [closed]

Sorry for the noob question. I'm using Matlab version R2012b on a computer that's running 64 bit Linux. It seems that no version of Matlab's parallel computing toolbox will work for me. Can anyone ...
2k views

### How can I get Octave to correctly compute a double integral of a piecewise function?

Computational Science People: The title is the question. I am trying to numerically compute a certain integral over a square in Octave (an open-source Matlab clone). I'm getting the wrong answer. ...
922 views

### export pde solution to non-uniform grid

After exporting the solution (u) and the mesh (p, e, t) from pdetool to workspace, I need to compute the solution at a set of predefined points. These predefined points where the solution is sought ...
2k views

I need to build a system in Simulink that solves a PDE, but I can't find any literature or books where it is described how to do it (especially any stuff according to modeling PDE in Simulink). ...
967 views

### Code to numerically integrate a system of first-order ODEs

I need to solve the following system of differential equations. When I have the solutions for $n_f$ and $v$, I need to find and plot $J=-e_\cdot n_{f} \cdot v$. I wrote a code in matlab with all ...
3k views

### Matlab output in scientific notation [ERROR: Subscript indices must either be real positive integers or logicals.]

I have X, Y and Z variables in matrix form, each of size n x 1. Eg.: X = [-38.0400, -38.6700, -38.9300, -39.4500...] Whenever I run the code below: ...
1k views

### Introductory tutorial for Monte Carlo computations on the GPU?

Monte Carlo simulations for MATLAB sometimes require a huge usage of CPU and in some cases may take a long time. MATLAB has provided some structures in order to enable the parallel processing. But I ...
335 views

### Nanoseconds vs. picoseconds in numerical quantum problems with Matlab ODEs

Hello there and thanks for taking a look at this problem. This problem is related to my previous question and I will therefore use a similar introduction from, Choice of step size using ODEs in ...
448 views

### Convert hour of the year into date in Matlab [closed]

I am a new Matlab user and wondering if there is any built-in operator or function which could convert the hour of the year into calendar date and time for that year. For example, Hour 0 in year ...
172 views

128 views

### How to save a matlab source code into a string in matlab?

I want to save a matlab source code into a string format in matlab. Does anyone know how to do this? For example, type xxx.m can display the source code of xxx.m. ...
941 views

### How can I compute whether a sequence is an even or odd permutation of an increasing sequence? [closed]

Variants of this question have been crossposted to Stack Overflow and Mathematics Stack Exchange. Additional answers may be found at these other sites. Computational Science People: I originally ...
7k views