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
20 views

Newtons Method to solve equations

The question is the following: Use Newton’s method to solve $$x^3_1+x_2=1,\\ x^3_2−x_1=−1 $$ Indicate your initial condition and how many steps it requires to reach the tolerate of error to be ...
0
votes
1answer
23 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 ...
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 ...
2
votes
2answers
78 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 ...
-3
votes
0answers
11 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 ...
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$, ...
-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
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 ...
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 ...
1
vote
0answers
18 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
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? ...
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
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
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
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
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 ...
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' ". ...
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 ...
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 ...
0
votes
1answer
105 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 ...
-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: ...
0
votes
0answers
33 views

DFT of vector $(0, 1, 2, 3)$

The problem is that my answer is different from answer i get in MATLAB. My answer is $(6, -2-2i, -2, -2+2i)$ while MATLAB answer is $(6, -2+2i, -2, -2-2i).$ In MATLAB i use command ...
1
vote
0answers
71 views

Math notation for expressions using logical (binary) masks on images (matrix)

I need to write up what I have written in matlab: I have an image (that is, a matrix) $K$ and some other matrix of the same size $M$ which acts as a mask which represents the values I would like to ...
2
votes
1answer
22 views

improving symbolic generation of objective function for optimization

I am currently using matlab to solve an optimization problem. I am generating the objective function using the symbolic toolbox. I planned use the symbolic toolbox to calculate the gradient and ...
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 ...
1
vote
1answer
70 views

MATLAB curve fitting - least squares method - wrong “fit” using high degrees

Anyone here that could help me with the following problem? The following code calculates the best polynomial fit to a given data-set, that is; a polynomial of a specified degree. Unfortunately, ...
1
vote
1answer
27 views

Compute $\left(a_{i}A+B\right)^{-1},\qquad i=1,\ldots,N$ efficiently?

I need to compute the inverse matrix: $$(a_i A+B)^{-1}, \qquad i=1,\ldots,N$$ where $N$ is a large number. $A$ and $B$ are general $M\times M$ matrices independent of $i$. The only thing that ...
0
votes
1answer
39 views

How to define a meshgrid (x,y) between the intersection of two oblique lines.

How can I create a meshgrid to draw a 3d surface in a domain (zone 1) defined by the intersection of two oblique lines in Matlab (see attached figure)1. The variables 0
2
votes
0answers
94 views

how to use Matlab ifft to calculate the following integral? [duplicate]

$$R(t)=\int_{-\infty}^\infty\dfrac{\omega e^{i\omega t}}{(3-\omega^2)^{2}+4\omega^2}\,d\omega$$ where t is a integer and $t>0$ I used to calculate this integral by numerical integral,but it seems ...
0
votes
2answers
70 views

How to use Monte Carlo method to find volume?

So the question asks to use the Monte Carlo method to find the volume of an irregular figure defined as: ...
0
votes
1answer
21 views

Matrix Factorization of lower triangular and unit upper triangular.

So I have a matrix. $$A =\begin{bmatrix} 8 && -3 && 2 && -1\\ -3 && 8 && 0 && 2\\ 2 && 0 && 8 && -3\\ ...
1
vote
1answer
29 views

Gauss quadrature on tetrahedron

I have the Weights ${\bf w}=[w_1\,w_2\, w_3\, w_4]=[0.25, 0.25, 0.25, 0.25]/6$ and the points ${\bf x_1}=[0.1381966011250105 , 0.1381966011250105 , 0.1381966011250105]$ ${\bf ...
0
votes
0answers
27 views

Guassian quadrature

Consider the polynomial $L \in P_5$ defined by $$L(x)=\frac{d}{dx^3}(1-x^2)^4$$ My question is to use a technique similar to the one used in the analysis of the Gaussian quadrature to show that Q has ...
1
vote
1answer
23 views

Replaces data in a matrix with Matlab

A is a matrix (6 ×6) defined as: A= [0.25 0.35 0.46 0.56 0.67 0.78; 0.25 0.37 0.49 0.61 0.73 0.86; 0.25 0.38 0.52 0.66 1.80 1.94; 0.25 0.40 ...
0
votes
0answers
13 views

Optimization of nested models

Hi everyone, I'm programming in Matlab and I have the following optimization problem in calibrating several nested model specifications. Summary: I have two models ($1$ and $2$, $1$ is nested in ...