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

learn more… | top users | synonyms

0
votes
1answer
21 views

find the root with the bisection method

The instructions of the problem are: Use bisection method to find a root of the function $$ \sin x + x \cos x = 0 $$ Indicate your initial condition and how many steps it requires to reach the ...
2
votes
2answers
67 views

How to calculate exp(-x) using Taylor series

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

Solving a sparse Least Squares problem or breaking it to separate least squares problems

I would like to solve a Least Squares (LS) problem of the form y=Fx. Let's assume for simplicity that $y \in \mathbb{R}^{2N}$ vector, $F= \left[ \begin{array}{cc} F_1 & 0 \\ 0 & F_2 ...
1
vote
0answers
14 views

Laplace approximation for binomial distribution in matlab

i using bionrnd() function to generate a random vector and Laplace approximation formula to approximate the binomial distribution. but Laplace histogram dose not ...
0
votes
1answer
23 views

How to use matlab for plotting functions that contain summations?

I am having a terrible time trying to figure out how to plot this function in matlab: $$\frac{1}{\pi} + \frac{1}{2}\sin(4t) - \frac{2}{\pi} \sum\limits_{k=2,4,6,8}\frac{\cos(4kt)}{k^2-1}$$ I am not ...
0
votes
0answers
8 views

MATLAB code based on a binomial random matrix [on hold]

I have a matrix, A, with $40000$ binomial random elements. I am trying to complete the following code and would appreciate help: I need to create $40000$ arrays $X_n$, where $X_n$ represents the ...
-3
votes
0answers
10 views

HOW TO PLOT DAG (DIRECTED ACYCLIC GRAPH) in BNT toolbox for matlab.

I have used markov chain monte carlo (MCMC) in BNT toolbox for matlab, from which i have got one output "sampled_graphs " which is cell array. Now how to plot DAG (Directed acyclic graph ) from ...
0
votes
0answers
13 views

How to implement this formula

I'm trying to understand a formula so that I can implement it in C++. In SLAM, the robot moves and scans an unknown environment. In 2D laser sensor, a measurement $z$ to landmark (i.e. physical ...
1
vote
4answers
69 views

Solving a homogeneous system of three ODEs with variable coefficients.

I am interested in solving the following system of ODEs: $$ \begin{pmatrix} x'(t) \\ y'(t) \\z'(t) \end{pmatrix} = a \begin{pmatrix} 0 & -B_2 & B_1 \sin \omega t \\ B_2 & 0& -B_1 ...
-2
votes
0answers
93 views

Evaluating a product (and sum) of polynomials in MATLAB [closed]

I'm new to MATLAB (and programming in general) and there's something I've been having a lot of trouble with. I want to evaluate the Lebesgue function with MATLAB. The function is as follows: $ L(x)= ...
0
votes
2answers
38 views

Generating a random binary matrix with fixed number of nonzeros

I want an algorithm (just the idea, not the actual code) to generate a random $n$ by $n$ matrix with binary entries, but with the condition that the number of nonzeros must be a fixed number $c$. Any ...
-1
votes
0answers
21 views

Solving a nonlinear equation of two unknowns (a matrix and a vector) using fsolve in Matlab?

I am solving a nonlinear equation in Matlab using fsolve. The equation is $$W(BKhQ)e^{W(BKhQ)+Ah}-BKh=0,$$ where $W$ is the Lambert $W$ function. Also $A$, $B$, ...
0
votes
2answers
543 views

How to calculate the hessian of a matrix function

I am estimating a model minimizing the following objective function, $ M(\theta) = (Z'G(\theta))'W(Z'G(\theta))$ $Z$ is an $N \times L$ matrix of data, and $W$ is an $L\times L$ weight matrix, ...
0
votes
1answer
39 views

How to collect coefficients of the same powers?

I am using the Symbolic Math Toolbox, and define polynomials as symbolic objects, e.g.: syms a x y; P = x^2*y + a*x*y^2 + x*y^2; I am looking for a function that ...
2
votes
2answers
29 views

Evaluating differential entropies with Matlab: NaN issue

With Matlab I am trying to evaluate differential entropies. These are integrals like $$\int_\mathbb{R} p(x) \log (p(x)) \mathrm{d}x$$ where $p(x)$ is a probability density function. My $p(x)$ is ...
4
votes
2answers
1k 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 ...
1
vote
0answers
17 views

how to conceptually visualize data structures in Matlab

I tend to think of data structures of type Structure.Field.Subfield as analogous to file directories. I.e that Structure is a folder and Field is a folder inside the folder.. etc. Is this a good way ...
0
votes
0answers
14 views

Importance of Initial Guess in the numerical solution to the following fluid flow problem

Greetings Stackexchange community. Forgive me if the question is repetitive and/or answered before. I am currently working on a simple fluid flow problem, 'Heated laminar vertical Jet'/Brand and Lahey ...
0
votes
1answer
456 views

Autocorrelation and spectral density in MATLAB

This question is twofold. We have an LTI system that is a first degree Butterworth LP filter with the power TF where fu = 110Hz and ...
1
vote
2answers
2k views

time derivative of discrete data in simulink

I'm implementing a program in Java that was delivered in Simulink. My expertise is limited, and I'm stuck on converting a derivative block. The simulink code applies a du/dt block to the input data. ...
0
votes
1answer
25 views

Integrate complicated function

Can someone help me write this in matlab? (I just need to transfer the formula to matlab format so I integrate it): $$\int_{point(i)}^{point(i+1)}((x-c(i))^2*normpdf(x, -0.04, sqrt(0.11)))$$ ...
1
vote
1answer
47 views

Matlab numerical integration involving Bessel functions returns NaN

I need to numerically compute integrals such as this (some parameters omitted for simplicity): $$ \int_{0}^{\infty} e^{-x^2} I_{0}(x) K_{0}(x) \mathrm{d}x $$ where $I_{0}$ and $K_{0}$ denote the ...
2
votes
1answer
27 views

fft phase plot of pure sine function, why so messy?

I am plotting the phase plot of $sin(2*pi*60*x)$ in the frequency domain. Ideally, we should only see two peaks. How come this is not the case in matlab? ...
1
vote
1answer
661 views

Solving double integral numerically in matlab

In the paper "The fractional Laplacian operator on bounded domains as a special case of the nonlocal diffusion operator". Where the author has solved a fractional laplacian equation on bounded domain ...
0
votes
1answer
43 views

Evaluate derivative of Lagrange polynomials at construction points

Assume, that we have points $x_i$ with $i=1,...,N+1$. We construct the Lagrange basis polynomials as \begin{align} L_j(x) = \prod_{k\not = j} \frac{x-x_k}{x_j-x_k} \end{align} Now according to my ...
0
votes
1answer
463 views

convex hull function in matlab

Is there anyway to compute the convex hull of a finite set of points in Matlab and gives the half-space representation as its result? I usually use a toolbox called MPT developed at ETHZ Zurich, but ...
0
votes
0answers
42 views

High dimensional Differential Evolution

I want to minimize a cost function with Differential Evolution (DE) algorithm and I have 55 unknown parameters as an input for DE algorithm. Therefore, the DE should search in high-dimensional space ...
0
votes
1answer
268 views

Determining the direct and transverse tangent lines for two non-overlapping ellipses

I am trying to determine the direct and transverse lines for two non-overlapping ellipses. I specifically mean that the two ellipses are totally separated from each other with no shared regions. I ...
0
votes
1answer
39 views

Eigenvectors of singular matrices

I have the following problem (need to state that I am not sure if this is the correct place to ask this question, hope it is): for each velocity I have three set of eigenvalues: $\alpha_{12}$, ...
0
votes
0answers
21 views

Creating a Tetra-diagonal matrix in matlab

How can I create a tetra-diagonal nxn matrix, like the form for making tri diagonal matrix Creating a Tridiagonal matrix in matlab? ...
1
vote
0answers
13 views

Nonlinear optimization with range constraint

I am trying to solve the following problem, but so far each time trying to program either one or more of the constraints are not satisfied (using Matlab). Phrasing the problem in two different ways, ...
0
votes
0answers
10 views

Matlab. Gaussian mixture model. How to calculate confidence interval?

I have a the parameters of mixture of normal distributions (Gaussian Mixture Model) . How in Matlab to calculate the 95% confidence interval for the mixture of normal distributions? Thank you.
1
vote
1answer
55 views

How does Matlab, Maple, etc…solve algebraic and differential equations internally?

I would be very interested finding out how does Matlab, Maple, etc…solve algebraic and differential equations internally? Anyone know how they do it?
0
votes
2answers
41 views

How to solve $Ax=b$ via backward and forward substitution on Matlab

How can I solve $Ax=b$ in Matlab code via LU factorization. I know that the command [L,U]=LU(A) stores the ...
2
votes
1answer
2k views

Solve a second order DEQ using Euler's method in MATLAB

I need to solve the equation below with Euler's method: $$y''+ \pi ye^{x/3}(2y' \sin(\pi x)+\pi y\cos (\pi x)) = \frac{y}{9}$$ for the initial conditions $y(0)=1$, $y'(0)=-1/3$ So I know I ...
0
votes
0answers
26 views

IIR Filter - Finding Magnitude and Phase

I've been asked to plot the magnitude and phase response of this IIR filter. $H(z)=\frac{0.0534(1+z^{-1})(1-1.0166z^{-1}+z^{-2})}{(1 - 0.683z^{-1})(1-1.4461z^{-1}+0.7957z^{-2})}$ And I've found a ...
0
votes
0answers
10 views

MLGetFigure for copy Matlab figures into Excel spreadsheet [migrated]

For to copy several error histogram () figures (by a loop) into an Excel spreadsheet, I try use MLGetFigure; but I get "Undefined function ('MLGetFigure') for input arguments of type 'double' ". ...
0
votes
1answer
43 views

Inverse Power Iteration converges to largest eigenvalue instead of smallest?

I am trying to write a Matlab function that takes a matrix and an iteration count and performs inverse power iteration to output the smallest eigenvalue. The problem is, as k increases, the function ...
5
votes
1answer
2k 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 ...
0
votes
0answers
43 views

Low rank approximation using CVX toolbox in Matlab

I try to use CVX toolbox to do "low rank approximation" work. The code is as follows: ...
1
vote
1answer
31 views

Row-wise non zero product in matrix notation

If I have a matrix $\mathbf{A}\in R^{m\times n}$, I'd like to express in matrix notation (or at least in a good mathematical notation) the vector $\mathbf{z}\in R^{m}$ whose $i$-th component is the ...
0
votes
1answer
24 views

uniqueness of svd decomposition and its role in statistical analysis

let us consider following model according to following link http://www4.ncsu.edu/~ipsen/REU09/chapter4.pdf it says that : The singular values are unique, but the singular vector matrices are ...
1
vote
0answers
44 views

How to calculate wavelet energy?

Part of my assignment about signal processing says the following: Compute the Discrete Wavelet Transform for the input signals Group the wavelet coefficients in trees growing across scales ...
1
vote
1answer
1k views

How I can get coefficients matrix in MATLAB from the set of linear equations?

I am working in MATLAB and having problem in extraction of coefficients out of my set of symbolic linear equations. Equations are as such R = [0.8978*c - 0.8047*b - 0.020299*a, 0.8978*d - ...
0
votes
1answer
104 views

Implementing 1D Discrete Wavelet Transform in Matlab

I'm trying to write my own version of the Discrete Wavelet Transform using the bior4.4 filters. I think my implementation is not properly working yet, because whenever I input a signal and a number ...
0
votes
1answer
34 views

why do I get the following result with Matlab's SVD?

I am doing an SVD on a random matrix in Matlab $A = U S V'$. Then, I do calculate $B = U V'$. Finally, I do SVD on $B = U_2 S_2 V_2'$. I would expect $U_2 = U$ and $V_2 = V$ up to a permutation and ...
-2
votes
1answer
18 views

plot multiple discrete graphs on the same figure

having troubles using 3 stem function on the same figure. my code (only for the plot part) is: ...
3
votes
3answers
4k views

Understanding Fourier transform example in Matlab

I'm studying about Fourier series and transform and I get confused with the following Matlab example of Fourier transformation: ...
2
votes
1answer
74 views

Creating an ellipsoidal 3D surface

I am trying to find the equation of a 3D ellipsoidal surface. I have thought of two approaches which are schematically shown below: By revolving an elliptical arc over a 3D elliptical path: Or by ...