# Tagged Questions

MATLAB is a high-level language and interactive programming environment for numerical computation and visualization developed by MathWorks. MATLAB can be used when performing tasks such as signal processing and communications, image and video processing, computational finance, and computational ...

13k views

### Is Sage on the same level as Mathematica or Matlab for graph theory and graph visualization?

The context: I'm going to start working on a project that involves running predefined algorithms (and defining my own) for very big graphs (thousands of nodes). Visualization would also be welcome if ...
2k views

### Matlab wrong cube root

How can I get MATLAB to calculate $(-1)^{1/3}$ as $-1$? Why is it giving me $0.5000 + 0.8660i$ as solution? I have same problem with $({-1\over0.1690})^{1/3}$ which should be negative.
22k views

### Matlab code for generating random symmetric positive definite matrix

Could anybody tell me How to generate random symmetric positive definite matrix using Matlab? Thank you very much for the help and suggestions.
500 views

### What function could describe this GIF animation?

I found this image on Beautiful Mathematical GIFs Will Mesmerize You and this GIF really caught my attention. From what I see, it's a 2D circle morphing into the 3D sphere. What function could ...
3k views

### Fast Matlab Code for hypergeometric function $_2F_1$

I am looking for a good numerical algorithm to evaluate the hypergeometric function $_2F_1$ in Matlab (hypergeom in Matlab is very slow). I looked across the ...
25k views

### Piecewise function plot in Matlab

Is it possible in Matlab to plot an even piecewise function like: $f(x) = \begin{cases} 3t , 0 < t < \pi \\ -3t , -\pi \le t \le 0 \end{cases}$ which has a period of $2\pi$. I can'...
5k views

319 views

### Why can you not omit the '*' sign for multiplication in Sage, Matlab, and other mathematical software? [closed]

Question I have some experience with Sage and Matlab. Both mathematical software packages require you to have the '*' sign when multiplying symbolic variables with integers. For example, in Matlab ...
162 views

### Generating $n\times n$ random matrix with rank $n/2$ using matlab

Can we generate $n \times n$ random matrix having any desired rank? I have to generate a $n\times n$ random matrix having rank $n/2$. Thanks for your time and help.
182 views

### What is the difficulty when calculating this integral?

"What is the difficulty when calculating the integral $$\int_0^∞ \frac{6}{x^7+2x+1} dx$$ ? Solve the integral with matlab's quad." Sorry for my bad formatting, I'm just learning this formatting. ...
327 views

### How to use Newton's method to find the roots of an oscillating polynomial?

Use Newton’s method to find the roots of $32x^6 − 48x^4 + 18x^2 − 1 = 0$ accurate to within $10^{-5}$. Newton's method requires the derivative of this function, which is easy to find. Problem is, ...
1k views

### How can I write an SDE in Matlab?

My professor would like me to solve a system similar to the following: $$dx_i=[f_i(x_1,x_2,...x_n)]dt + g_ix_idW_i$$ Where $g_i$ are positive constants that measure the amplitude of the random ...
4k views

### Solving $Ax=b$ under $L_1$ $|Ax-b|$ minimization

I would like to solve a linear system $Ax = b$ under the $L_1$ norm constraint $\min(|Ax-b|)$. All that I can find about $L_1$ minimization is a way to minimize $|x|_1$ subject to $Ax=b$. I wanted to ...
4k views

### Visualizing elemental rotations using Euler angles in Matlab

I'd like to visualize elemental rotations using Z-Y-X convention in Matlab. If you'd like to follow me exactly, I'll be refering to a paper Quadrotor Dynamics and Control by Randal Beard. The base ...
23k views

### Creating a Tridiagonal matrix in matlab

How can I create a tridiagonal matrix that I can use for Crout factorization? And, I don't have any codes on how to create one since I am new to matlab. Ok, please help me understand what does the ...
605 views

### Best Math Plotting Software for Electrical Engineering

I am an electrical engineering undergrad. I would like to learn a math plotting software which would be helpful in visualizing topics in advanced calculus (my immediate need). It would also be helpful ...
1k views

### How to calculate $\exp(-x)$ using Taylor series

We know that the Taylor series expansion of $e^x$ is $$e^x = \sum\limits_{i=1}^{\infty}\frac{x^{i-1}}{(i-1)!}.$$ If I have to use this formula to evaluate $e^{-20}$, how ...
2k views

### How to randomly construct a square full-ranked matrix with low determinant?

How to randomly construct a square (1000*1000) full-ranked matrix with low determinant? I have tried the following method, but it failed. In MATLAB, I just use: n=100; A=randi([0 1], n, n); while ...
1k views

### Inverse problem from pdes

A linear inverse problem is given by: $\ \mathbf{d}=\mathbf{A}\mathbf{m}+\mathbf{e}$ where d: observed data, A: theory operator, m: unknown model and e: error. To minimize the effect of the noise; ...
853 views

### Incomplete beta function in MATLAB

Mathematica is capable of evaluating the incomplete beta function $$\mathrm{Beta}[z,a,b] = \int_0^z u^{a-1}\left(1-u\right)^{b-1}\,du$$ even when the argument $z$ is negative. MATLAB's function <...
2k views

### Time complexity of quadratic programming

I am using the Matlab built-in quadprog to solve a quadratic program with linear constraints. I vaguely recalled from school that the time complexity of quadratic programming should be $O(n^3)$, and I ...
10k views

### To invert a Matrix, Condition number should be less than what?

I see that there is a matlab tag in this site, so I ask my question here and not in stackoverflow although it is also related to programming in matlab. I am going to invert a positive definite matrix ...
4k views

### How to generate orthogonal matrix in Octave?

How to generate an orthogonal matrix in Octave? I saw something like that gallery('orthog',n,k) in matlab, but I can't find ...
99 views

### Principal component analysis (PCA) results in sinusoids, what is the underlying cause?

Background I'm analysing a data set of $M$ flow measurements (volume per time). The flows go from zero mL/s gradually to higher values and back to zero again, thus: their shapes ideally look like a ...
2k 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 ...
2k views

### Fitting an exponential function to data

I have a noisy data set (the grey line in the graph below) that corresponds roughly to $y=m(1-2^{-x/k})$ where m and k are unknown constants. How can I determine the best-fit value of m and k? I ...
1k views

### Matlab code for finding the curvature of a curve using given data points

I have data points $(x,y)$ for a plane curve, and I would like to find its curvature. Wwhile I was googling to check how could I start, I found this matlab code: ...
44 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 ...
196 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 ...
489 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 ...
500 views

803 views

### Eigenvalues of unitary matrices

I have a sparse unitary matrix with complex entries and want to compute all its eigenvalues. Unfortunately, matlab doesn't like this. If I try do enter eigs(A, N) (A the matrix, N its size), it tells ...
80 views

### Numerical Differentiation Matlab

I am trying to estimate the second derivative of $\sin(x)$ at $0.4$ for $h=10^{-k}, \ \ k=1, 2, ..., 20$ using: $$\frac{f(x+h)-2f(x)+f(x-h)}{h^2}\tag{1}$$ And then plot the error as a function of $h$...
67 views

### Did I do something wrong solving this PDE in MATLAB?

I have the following PDE problem on a practice exam: I have completed the problem using MATLAB to the best of my ability. Here is the code I used ...
### How can I set values going up by powers of $2$ in matlab [closed]
I am writing a code which will need values of $\sin(x)$ for $x = 2^2, 2^3, 2^4, \dots, 2^{25}$ Being fairly new at matlab still, I am unsure how to do this in the most efficient manner. I know <...