# Questions tagged [matlab]

For mathematical questions about MATLAB; questions purely about the language, syntax, or runtime errors would likely be better received on Stack Overflow. MATLAB is a high-level language and interactive programming environment for numerical computation and visualization developed by MathWorks.

2,619 questions
Filter by
Sorted by
Tagged with
950 views

### Finite Element Method for the 1d wave equation

I'm solving the 1D wave equation \begin{equation} \frac{\partial^2 \eta}{\partial t ^2} - \frac{\partial^2 \eta}{\partial x ^2} = 0 \end{equation} with boundary conditions \begin{equation} \frac{\...
1k views

20k views

### write text using an equation

Well like the batman equations and equations for heart, I once saw a site that draws equation for whatever text you type....but now I can't find it. Does anybody know such a site? Also a general ...
1k views

### Conditional Number growth of Hilbert Matrix: Theoretical vs MatLab.

I need to investigate how the condition number of the Hilbert matrix grows with the size N. The Matlab command is: "cond(hilb(N),2)" Compute the condition number of the Hilbert matrices Hn ∈ R, N×N, ...
6k views

### What is the convergence order and asymptotic error constant for these results?

Define order of convergence and asymptotic error constant for a numerical method for equation solving. Two different methods have been used to solve the equations f(x)=0. Runs in Matlab give the ...
1k views

### Factorize Positive Definite Symmetric Matrix

Let's start from the assumption of disposal of a positive definite symmetric matrix of size $\ (N,N)$. For some reason I have to factorize this matrix: I am already aware of the ...
3k views

### MATLAB software for graph theory

I'm currently working on an undergraduate thesis that requires the use of graph theory(shortest path problem) in MATLAB. However, all the graph functions that I see in the MATLAB help bar do not make ...
251 views

### What algorithm is used in Matlab's pade function?

I try to find out for quite some time now, how Matlab implements the calculation of Padé Approximants using its symbolic pade function. (the code of is buried in a ...
5k views

### LU Decomposition vs. QR Decomposition for similar problems

Suppose I want to solve the 2D Poisson equation with Neumann boundary conditions. The solution is non-unique up to an additive constant. I have previously asked a related question here for the 1D ...
2k views

### making a sequence of numbers in octave and matlab

I know I can make a sequence of numbers in matlab / octave using x=1:1:5 and it will give me 1,2,3,4,5 but how can I get a ...
4k views

### Can we make such matlab code so that every time we run the program it will return the same randomly generated matrices?

I want to compare efficiency of two iteration methods for computing inverse of a matrices. I want to test performance of these methods on some randomly generated matrices. I want to know can we make ...
210 views

### Matrix of matrices in matlab

I need to build up the matrix of matrices. Say, for all $1\leq i,j\leq n$ I have to define a matrix $p_{ij}$ which will be a matrix $n\times n$. What I can do - it is to build up a matrix $P$ which is ...
860 views

### Normality test vs. Fitting a Gaussian curve

I have a set of one-dimensional data, and I suspect that the data is normally distributed. Before embarking in a normality test, I decided to fit a Gaussian curve to the histogram of relative ...
341 views

### Finding analytical solutions for given equations

I have a system of 6 equations with 6 variables. The 6 variables are $t11, t12, t13, t21, t22, t23$ and the rest of the symbols in the equations are known symbols. I want to find all the possible ...
188 views

### If $X$ is symmetric, show $k(X^2)$ = $k(X)^2$

Suppose we have a symmetric invertible matrix $X$. How can I find $k(X^2)$ in terms of $k(X)$? Note that $k$ represents the condition number operation, that is $k(X) = \|X\|\,\|X^{-1}\|$. So, after ...
114 views

### How can I compute $\sum_{i=1}^n x_i \log(x_i)$ in a stable manner?

Given a vector in $\mathbb{R}^n$ I have an algorithm to compute $$\sum_{i=1}^n x_i \log(x_i)$$ However for my application the norm of $x$ must be 1, hence for big $n$ the components tend to be too ...
927 views

### Newton's Method: Found a case where it doesn't work. Why?

So I was looking to use Newton's Method to evaluate $x^3-2*x+2 = 0$. I noticed that I could plug in a negative number for $x_0$ and it worked but when I tried $x_0 = 0$ then my code started going ...
980 views

### Due to numerical inaccuracy, the solution of a boundary value problems becomes negative

I treat a toy example to get my point across. In reality I have to deal with a much more complex model. Let us consider a one dimensional boundary value problem using the bvp5c solver in Matlab. Two ...
4k views

### How to compute elliptic integrals in MATLAB

I need to calculate the complete elliptic integrals of the first and second kind , the incomplete elliptic integral of the first kind, and the incomplete elliptic integral of the second kind in MATLAB....
2k views

### Dot product over complex vectors: Conjugate first or second?

Does there exist a truly "standard" dot product over complex vectors? Wikipedia and Wolfram's MathWorld indicate directly or indirectly that the second argument is conjugated. Matlab's ...
14k views

### How can I write a tensor in MATLAB?

My project is about tensors and I must write the program in MATLAB. How can I write a tensor in MATLAB? Is there anybody to help me? Can you explain me what is the code for import a tensor? thanks for ...
560 views

487 views

### fft of point wise product

I have a sequence a = [1 2 3 4 5 6 7 8], and a weighting ...
904 views

### Using Monte Carlo method to estimate the value of $\int_0^1\int_0^1e^{xy} \ dx \ dy$

Monte Carlo, estimate the value of $$\int_0^1\int_0^1e^{xy} \ dx \ dy.$$ I am using matlab to solve this problem. My code is the following: ...
199 views

### Solve the differential equation: $y''+(1-2x)y'+2x(e^{x^{2}}-1)y=xe^{x^{2}}$

I have an exercise of solving the equation above using MATLAB, with a hint to set $v(x)=(y'+y)e^{-x^{2}}$. I tried to do with my hand and get the following: $v'+2xy=x$, but I don't know what to do ...
363 views

### Numerical Integration of $\int_0^1 \log(x) dx$

Do you guys have any idea how to handle something like $\int_0^1 log(x) dx$ numerically in Matlab (I'm only interested in the real part btw)? I have used Quad, Quadl, "integral" etc all of them ...