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
0answers
215 views

Implementing the $\theta$-method for solving an IVP

I want to implement the $\theta$-method to solve an IVP in MATLAB. The $\theta$-method is: $y_{j+1} = y_j + h[\theta f(t_j, y_j) + (1 - \theta)f(t_{j+1}, y_{j+1})]$ for $\theta \in [0, 1]$. I want ...
0
votes
1answer
244 views

Matlab: How to Exclude Zero from Domain?

I want to plot the wireframe surface of $f(x,y)=\frac{x^2-y^2}{x^2+y^2}$ in Matlab. The code I typed is as follows. x=-0.1:.001:0.1; y=-0.1:.001:0.1; [X,Y]= meshgrid(x,y); ...
1
vote
0answers
57 views

Help in implementing of peak function in Fourier transform

I have a function Peak function I know how to implement it in time range just need to caclulate $r$. first I initial $x$, y with a range and meshgrid them, after it calculate $r$ ...
0
votes
0answers
34 views

Covariance calculation for mixture Gauss

This equation what I found on the wikipedia is a bit strange for me. How I can compute in matlab? If example the size(x) = [1000, 2](2 dimension gauss) then $size(\mu) = [1, 2]$ for each cluster. ...
1
vote
1answer
99 views

Find the maximal switching period that ensures asymptotic stability of the switching system.

I have a time-dependent switched system $\mathbf{\dot{x}} = \mathbf{A}_i\mathbf{x}$. With $$\mathbf{A}_1 = \begin{bmatrix} -0.5 & 1 \\ 100 & -1 \end{bmatrix} \quad \mathbf{A}_2 = ...
1
vote
1answer
388 views

Discretization of differential equation via FFT routine

I just have a question related to the following problem: Find a discrete approximation to the differential equation $u^{\prime \prime} + 2u^{\prime} + 2u = 3\cos(6t)$ using Equation 3.12 for these ...
0
votes
0answers
171 views

Choose a right optimization method

I have a question related to optimization method selection. Suppose now I have some observation data (1D) as well as the underlying function model. For example, I use the following codes to generate ...
2
votes
1answer
223 views

Matlab plotting

Given the following linear system of differential equations $u'(t) = 6u(t)+9v(t)+15w(t)$ $v'(t)=-5u(t)-10v(t)-21w(t)$ $w'(t)=2u(t)+5v(t)+11w(t)$ with the initial conditions $u(0)=1, v(0)=2, ...
3
votes
3answers
396 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 ...
0
votes
1answer
3k 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 ...
3
votes
1answer
117 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 ...
3
votes
2answers
3k views

heat equation with Neumann B.C in matlab

$$ \frac{\partial u}{\partial t}=\alpha\frac{\partial^{2}u}{\partial x^{2}} \qquad u(x,0)=f(x)\qquad u_{x}(0,t)=0\qquad u_{x}(1,t)=2 $$ i'm trying to code the above heat equation with neumann b.c. ...
3
votes
1answer
487 views

MatLab - Fast Fourier Transform

I have just started messing around with the fft function in MatLab, but can't quite understand the output. Say I write the following: ...
0
votes
1answer
62 views

Tensor ; How can i recognize the type of tensor???

I want to use Matlab for my project. matlab has tensor toolbox and in it there are two types of tensor : Dens tensor and sparse tensor. my project is about " fiber orientation". how can i know what ...
0
votes
1answer
80 views

matlab differential equation

I have followed the tutorial on http://www.mit.edu/people/abbe/matlab/ode.html and prepared a function as follows: ...
2
votes
1answer
351 views

Stratified Monte Carlo

Consider the integral $I=\int_{0}^{1}e^{-x}dx$. Now consider the stratifed Monte Carlo estimate $\hat{I^{s}}$, that has $N_{st}=8$ strata. What is the variance of $\hat{I^{s}}$? What is the percent ...
1
vote
1answer
80 views

Evaluating the similarity of watermarks

I am working on an assignment where we have to use the NEC algorithm for inserting and extracting a watermark from an image file. Using the techniques described in this article. I am at the point ...
5
votes
1answer
1k views

Expected Value and Variance of Monte Carlo Estimate of $\int_{0}^{1}e^{-x}dx$

Given the integral: $I=\int_{0}^{1}e^{-x}dx$, use standard Monte Carlo with 1000 random numbers and repeat the simulation 1000 times. (a) What is the expected value and variance of the simple Monte ...
0
votes
1answer
11k views

Newton Raphson Iteration method in Matlab

I am currently trying to learn how to use ${\tt Matlab}$ properly but having a bit of trouble, I want to write a code that, say i had a differentiable function, will take as input $f$, $f'$, $x_0$ ...
4
votes
2answers
941 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 ...
4
votes
1answer
353 views

Matlab numerical triple integral involving quotient of two small quantities

Math people: I am trying to use Matlab's "triplequad" to numerically evaluate the triple integral $$\int_0^1 \int_0^{r_1} \int_{r_1-r_0}^{r_1+r_0} \left[\frac{Ov(r_0,r_1,t)^2}{(\frac{4}{3}\pi ...
2
votes
0answers
68 views

Matlab: Analytical Solution of A Second Order Differential Equation [duplicate]

I would like to know how to use Matlab to find the analytical solution of$$\ddot{X} =\left(1- \frac{A^{2}}{2w^{2}} \right)X$$ I appreciate your reply. Thank you.
0
votes
1answer
2k views

Matlab Time Series (AR, MA, ARIMA)

Is there a function which calculates an AR(p), MA(q), ARIMA(p,q) process in MATLAB which is free. I know of Econometrics toolbox, but I have to pay for that. Is there a way to get around that?
2
votes
1answer
233 views

DNA sequence in MATLAB

I am wanting to count how many times synonymous and non- synonymous mutations appear in a sequence of DNA, given the number of synonymous and non- synonymous mutations in each 3 letter codon. ie given ...
2
votes
0answers
230 views

FFT in MATLAB is shifted in frequency [closed]

I have a signal in MATLAB on which I'd like to perform an FFT. My signal is stored in s, and I use the code below (inspired by the MATLAB help): ...
1
vote
0answers
258 views

computing determinants in MATLAB, round-off errors

I am experiencing a computational problem in MATLAB. I have a $p \times p$ matrix $A$ whose true value of the determinant is a very large positive number due to the construction of the matrix. ...
0
votes
1answer
1k views

Three step Adams-Moulton functional iteration

I'm given an IVP: $$y' = e^y, \;\;\;\; 0 \le t \le 0.20, \;\;\;\;\; y(0) = 1$$ The solution is: $$y(t) = 1 - \ln(1 - et)$$ Applying the three-step Adams-Moulton method to the problem is equivalent ...
0
votes
2answers
263 views

Matlab coding help

I need to graph the following functions on MATLAB: x(t)=(3/2)sin⁡(2t); y(t)=(-4/√15)e^(-1/2 t) sin(√15/2 t)+2e^((-1/2 t) )cos⁡(√15/2 t); h(t)=x(t)+y(t). I have the data points for this functions. I ...
1
vote
2answers
32 views

Define a 2 x 2 matrix that is the lower 2 x 2 block in A (Matlab)

First of all, on this Matlab exercise sheet that I am currently working through what does the term 'the lower 2 x 2 block' mean in the question below? $A = \left[\begin{array}\ 1 & 2 & 3 \\ ...
2
votes
1answer
170 views

Numerical Analysis using MATLAB. Find the condition number $\mu$

Find the condition number $\mu = |A||A^{-1}|$ for the Hilbert Matrix $A$ using the uniform form. $A = \left( \begin{array}{cccc} 1 &\frac{1}{2} & \frac{1}{3} &\frac{1}{4} \\ \frac{1}{2} ...
1
vote
0answers
104 views

cadf vs adf on residuals

I was wondering how I could interpret the results from the Spatial Econometric library's cadf and adf. Running cadf(TS1,TS2,0,1), I obtain the following: ...
0
votes
0answers
271 views

Matlab quadprog lower bound constraint ignored?

I am trying to solve an optimization problem with matlabs quadprog function. I have set up the problem to solve only equality constraints with lower bounds of 0. ...
1
vote
2answers
1k views

Numerically integrating a function of 3 variables with respect to 2 variables in Matlab

Math people: I have Googled this question, tried some suggestions, and none of them worked. I browsed the Similar Questions here and didn't find what I wanted. I apologize if this is a duplicate. ...
1
vote
0answers
51 views

Implementing Non Linear Optimization

I am trying to calculate model free implied volatility $\sigma_{\mathrm{MF}}$ for a relative performance index using the following method: $$ \sigma_{\mathrm{MF}}^2=2\sum_{i} ...
2
votes
1answer
158 views

non linear optimization

How to solve this optimization problem using matlab or some other tool. I know that, this is a convex problem with non-linear constraint $\rho\geq \rho_{min}$ , so i have tried many times it in ...
1
vote
1answer
124 views

Assigning Interval on MATLAB Symbols

I have constant symbols such as t = sym('t') c = sym('c') but I have to restrict these symbols with a constraint stating that t is between 0 and 1 (0 $\le$ t $\le$1). For c, 0 $\lt$ c $\lt$ 1 . I ...
1
vote
2answers
269 views

Solve a system of time-independent ODE's with vector constants

I have to solve numerically this set of Ordinary Differential Equations $$ \frac{dx_1}{ds} = \frac{1}{x_1} \left[x_2 \left(a + \frac{x_2}{s}\right)-\alpha x_1 z\right]$$ $$ \frac{dx_2}{ds} = ...
0
votes
2answers
112 views
0
votes
2answers
122 views

Numerical Analysis. Please, help with MATLAB.

Use the initial approximation $(p_0,q_0)=(-0.3,-1.3)$, and compute the next three approximations to the fixed point using a) Fixed-point iteration and equations : $p_{k+1} = g_{1}(p_k,q_k)$ and ...
2
votes
1answer
662 views

Matlab FFT-algorithm example, one simple question

This is a question about an example for the software Matlab, but I still chose to ask it here, since I suspect that the question is more about the math involved than the software itself. I want to ...
0
votes
0answers
456 views

Numerical integration of 2-d Gaussian Distribution in MATLAB

I am looking for a really fast way to integrate numerically the 2-dimensional gaussian density with identity covariance matrix ...
1
vote
2answers
8k views

Matrix is singular to working precision

I have a problem while evaluating inverse using inv in MATLAB. My matrix looks like this: ...
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
444 views

Regarding understanding of the following SVD code in matlab

I earlier had a doubt regarding pseudo-inverse of a matrix, and earlier I was using pinv function. But one of the answers gave an alternative technique that is ...
0
votes
1answer
1k views

Matlab, anonymous functions, making a piecewise function, how?

If I want to make a piecewise function where lets say $f(x) = x^2 +1$ at $1 \leq t \leq 2$ and zero elsewhere. How can I make this possible using an anonymous function? I wanted to invent y = @(t) ...
2
votes
1answer
59 views

How to generate the matrix $\mathbf{M}$ with $\operatorname{cov}(\mathbf{M})=\mathbf{I}$

How can I generate a random matrix $\mathbf{M}$ such that $\operatorname{cov}(\mathbf{M}) = \mathbf{I}$ (identity). I use matlab to generate $\mathbf{M}$.
0
votes
2answers
96 views

a question a bout plot in matlab [closed]

I am trying to plot 3-D figure in matlab. I know how to use plot3 and surface. But now I have a vector and no a matrix. Actually I have $(x,y)$ and $u(x,y)$ that $u(x,y)$ is obtained after solving my ...
0
votes
0answers
41 views

how to check system is linear or nonlinear by simulation?

I am trying to understand whether the given equation is linear or not? or which part of the equation is linear? and how can I search which kind of approximation is suitable for this by simulation? ...
2
votes
1answer
67 views

Regression with arbitrary norm

I have a function $f(X,Y,Z)$, which I know is polynomial of degree $3$. I have a set of samples $(X_i,Y_i,Z_i)$ and corresponding values of $f$. My task is to find (the best approximation of) the ...
3
votes
3answers
707 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 ...