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

2
votes
3answers
130 views

Least Squares method and Octave/Matlab [closed]

I'll try to be as clear as possible so that you understand what I'm trying to do and can help me I have twelve pairs of data $(x_1,y_1),....,(x_{12},y_{12})$ and from this data we established a model ...
0
votes
1answer
62 views

randomly rough surface by ifft : real output from ifft

I'm trying to generate a randomly rough isotropic surface with predefined roughness amplitudes (standard deviation of heights). Suppose I have the absolute values of fourier components of the surface ...
0
votes
1answer
203 views

MATLAB: minimize function using x value from previous iteration

I'm trying to develop an algorithm for a proximal point method defined as: $$ \underset{x \in \rm I\!R^n}{\arg\min} f(x) + \lambda g(x) $$ where f(x) is a convex and coercive function and also ...
6
votes
2answers
2k views

Implementing Ornstein–Uhlenbeck in Matlab

I am reading this article on Wikipedia, where three sample paths of different OU-processes are plotted. I would like to do the same to learn how this works, but I face troubles implementing it in ...
2
votes
1answer
137 views

Evaluate integral over complex path numerically to show that $C_\infty$ is equivalent to $-I$

I would like to evaluate $$C_\infty = \int_{R = -a}^{R = a} H_0^{(1)}(z) e^{-izt} dz $$ where $H_0^{(1)}(z)$ is the Hankel function of the first kind, $a \rightarrow \infty$, and $$ z = R - i \sqrt{...
2
votes
2answers
82 views

Secant method with two ODE's of degree 2 - matlab

$$\frac{d^2r}{dt^2}-r\left(\frac{d\phi}{dt}\right)^2=G\cos\alpha-g\frac{R^2}{r^2}$$ $$r\frac{d^2\phi}{dt^2}+2\frac{dr}{dt}\frac{d\phi}{dt}=G\sin\alpha$$ The two ODE's above are given. I have written ...
0
votes
2answers
133 views

please how to rotate a matrix $5\times4$ by 45° around the origin $(0,0)$? using matlab

Suppose I have a matrix $M$ of $5\times4$ dimension (this is represent an image) : M = [3 4 8 9; 1 6 7 3; 9 8 3 1; 1 2 2 0; 7 2 3 5]; ...
0
votes
0answers
65 views

Why do I get a big error when I compute this integral with Gauss-Legendre Quadrature?

I'm using Gauss-Legendre Quadrature to solve the following integral: $\int_0^{1}x^xdx$ After I've compared the result with the MatLab vpa(int(...)) of the same integral I've noticed that the ...
0
votes
2answers
106 views

Rational function regression without poles in a interval, or polynomial regression with positivity constraint

I have some sets of experimental data for some functions $f_i$ from $I=[0,1]$ onto itself, which should satisfy the following physical constraints: $f_i(0)=1$ $f_i(x) \in I= [0,1] \; \forall x \in I ...
0
votes
1answer
69 views

Are my results realistic or is there an error somewhere?

The background is that I'm solving a problem in Numerical Analysis which I asked about here: Is my derivate correctly programmed? Now if I use the new code, then I get a result that is along the ...
0
votes
1answer
71 views

Is my derivate correctly programmed?

I'm solving a problem in numerical analysis, page 9 of this text (soundwaves under water) and I think that I'm getting the correct result but I'm not sure if I programmed my derivate correct. My ...
0
votes
1answer
107 views

Dot product of a sinusoid with a complex tone in Octave

I am trying to figure out how to solve this problem; Now make a new sinusoid with amplitude 1 and frequency 1000Hz. Calculate the dot product of this sinusoid with your complex tone using ...
1
vote
1answer
38 views

How to program a little code that shows me the evolution of the system when starting with initial values?

I have rather no programming skills, neither with Matlab nor with other languages. I need a little "program" that shows me the evolution of a dynamical system when giving it some initial values. The ...
1
vote
0answers
76 views

problem implementing leave-one-out cross validation for optimal bandwidth in Matlab

I'm trying to solve an exercise in which I need to calculate the local constant kernel estimator and provide the bandwidth using leave-one-out cross validation. The idea is that I need to sort of ...
1
vote
0answers
55 views

How can we formulate the art gallery problem as a mixed-integer linear program?

Specifically, how would one go about using 'intlinprog' in MATLAB to get a minimum value for the cameras required in a polygon-shaped art gallery? In other words, I think that what I am looking for is ...
0
votes
1answer
71 views

Differential equation concerning echolocation

I am in the process of trying to solve a differential equation using MATLAB. Given information is the following: $$ c(z) = 4800 - 20.2090 + \frac{17.3368z}{1000}+272.9057e^\frac{-0.7528z}{1000} $$ $...
1
vote
0answers
126 views

Must Number of equality constraints and decision variables be equal?

Must Number of equality constraints and decision variables in an optimization problem be equal ? If not, how can I solve the equality constraint equations with a solver e.g. ...
2
votes
1answer
72 views

Theoretical and computational results of ODE differ a lot! Why?

Hello. I have a problem in that my theoretical and practical(computational) calculations differ a lot. in 1 order of magnitude actually. Impulse I needed to jump over the saddle point in one ...
1
vote
0answers
177 views

Difference between impulse and step response.

My question is quite simple but I have some difficulties finding an answer to it. I was wondering what was the difference between the impulse and step response functions in MATLAB. The "help" section ...
0
votes
1answer
55 views

Real logarithm of a real matrix?

What is the real logarithm of \begin{equation} \begin{pmatrix} -1 & 1 & 0 & 0 \\ 0 & -1 & 0 & 0 \\ 0 & 0 & -1 & 1 \\ 0 & 0 & 0 & -1 \end{pmatrix}? \end{...
0
votes
1answer
65 views

How to find Parameters in nonlinear Regression Model?

I have a nonlinear Regression Model with eleven observations of $x,y$. How do I find the parameters $a,b,c,d$ of the model: $ y=f(x)=a + b \sin cx e^{dx}$ by using the function: $$\Phi(a, b, c, d)=\...
-1
votes
1answer
240 views

how to check data fits gamma distribution in MATLAB ?

I have two vectors which also contain zeroes. I cannot remove the zeroes as that is also data. I have to see whether my data fits gamma distribution or not. How can I check that?
1
vote
1answer
155 views

How can I solve numerically this partial differential equation?

I am reading this paper and came across a system of differential equations with 4 ODEs and 1 PDE. The PDE is given below. My question is how to solve this numerically in MATLAB , Python or Mathematica?...
0
votes
1answer
348 views

Solving an equation in matlab

I would like to solve the equation: 1/2*logninv(x, 0.03-1/2*0.2^2 + log(100), 0.2^2) +1/2*logninv(x, 0.03-1/2*0.1^2 + log(100), 0.1^2) == 100 I can solve this ...
0
votes
0answers
26 views

Plotting Non Linear Programming functions

I define these functions in Matlab: ...
0
votes
2answers
302 views

Matlab Monte Carlo Method Volume Calculation

The question: use the Monte Carlo method to find the volume of intersection of, three cylinders, all of radius 3 units and infinite in length,with the axis of the first cylinder being the x-axis, the ...
0
votes
0answers
56 views

Finding $Q$ for any $A$ s.t. $QAQ^\top = I$

Given an invertible and PSD matrix $A$, I am looking to find $Q$ such that: $$ QAQ^\top = I $$ What is a/the right/efficient way to do this? Here is what I did: SVD gives $$ A \approx U S V^\top $$...
0
votes
1answer
225 views

How to solve the eigenvalues of a complex matrix of very high condition number?

WHAT I FACE: I'm dealing with a complex matrix of very high condition number and I have to solve the eigenvalue and eigenfunction of it. But in Matlab, I got the problem that the results are not ...
0
votes
1answer
130 views

Using the Monte Carlo method to find a volume

Use the Monte Carlo method to find the volume of intersection of, three cylinders, all of radius 3 units and in finite in length,with the axis of the first cylinder being the x-axis, the axis of the ...
1
vote
1answer
146 views

Trouble with derivatives using Newton-Raphson in MatLab

I'm finding it very difficult to get my head around how best to express the following system of equations in MatLab in order to solve it. The equations come from Von Karman's similarity solution to ...
1
vote
1answer
50 views

Can not build a phase space for simple oscillator

2 question is: how to move out the particle from the potential well? I am stuck on a problem that I have a simple harmonic oscillation for which I want to draw a phase space. I can do this inside the ...
1
vote
1answer
37 views

Regression project in octave/matlab

I'm trying to establish a polynomial model to adjust the variation of the dollar throughout the year. Suppose hypothetically that I have the following data ...
1
vote
1answer
58 views

Why do I get complex convergence?

I have problem with understanding why I get the complex convergence when using Newton-Raphson's method (own implemented) to the convergence tables down below: ...
0
votes
1answer
247 views

Solving a system of two second order ODEs using Runge-Kutta method (ode45) in MATLAB

I'm trying to solve the system of differential equations outlined in Von Karman's rotating disk flow. I got them into a system of ordinary differential equations: F(n), G(n), H(n) $$F'' = -G^2 + F^2 ...
0
votes
2answers
320 views

How do I determine the transfer function of a plant?

I sitting here with a system which I have to determine the transfer function. The unit receives a velocity and position, and move towards that position with the given velocity. What kind of test ...
0
votes
1answer
100 views

N body ODE simulation

I have been staring at the below matlab code, which simulates planetary motion, for a while now and I could really use a fresh set of eyes. I cannot understand why it is giving straight line ...
1
vote
0answers
41 views

Problem with plotting a differential equation

I have problem with plotting an differential equation that is as following: $$ \frac{d^2y}{dx^2} + \pi y e^{x/3}\big(2\frac{dy}{dx} \sin(\pi x) + \pi y\cos(\pi x)\big)=\frac{y}{9} $$ where the ...
1
vote
0answers
180 views

Eigenvalues and eigenvectors for earthquake modeling

My instructor explicitly stated that, because we are asked to find eigenvalues and eigenvectors of a $7\times 7$ matrix, MATLAB would be easiest to use. The equation $(1)$ is intended to resemble a ...
0
votes
1answer
668 views

Coefficients of a linear combination

Suppose I have a vector space $V$, with $\{\vec e_1, \ldots, \vec e_n\}$ forming a basis of $V$. Also, suppose that I have a vector $\vec x \in V$, which I want to express as the unique linear ...
1
vote
1answer
50 views

First order non-linear ordinary differential equation

The following ODE is given: $a\pm\sqrt{b+c*(x(t)+d))}=e*x'(t)+f*x(t) $ from Matlab I'm able to get a solution for the differential equation (actually two solutions, one for the + and one for the - ...
4
votes
1answer
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 ...
2
votes
2answers
126 views

Fourier Decompositon problem

have a look at this video of Fourier Decomposition of an image (otherwise you can also refer the image, which shows few plots of different extracted waves from an image). We also know that a Fourier ...
2
votes
1answer
2k views

Roll PID Control for quadcopter

I'm trying to implement with simulink a PD controller for my quadcopter. I use a simplified model, and for the roll case I have $ I_x * \phi = L $, where L is the roll torque. So, the transfer ...
1
vote
0answers
27 views

Is there any reason that cross correlation would perform well or poorly on sparse binary arrays?

I am using matlabs xcorr to correlate simulated photon count data that has some Gaussian random noise set on top of it and it is working fine when the average value in the arrays is greater than one ...
1
vote
1answer
140 views

tridiagonal matrix with a corner entry from upper diagonal

I am trying a construct a matlab code such that it will solve an almost tridiagonal matrix. The input I want to put in is the main diagonal (a), the upper diagonal (b) and the lower diagonal and the ...
-2
votes
1answer
76 views

Create matrix of coefficients in matlab

I have written a function that creates a matrix based on a polynomial of a given degree. I will ultimately use this to fit data, but the problem I am having is that I can not find a good way to create ...
1
vote
3answers
82 views

Converting nonlinear second order ODE to first order

The second order ODE is: $$ y'' + ky' + (mg/c)\sin(y) = 0 $$ $k$, $m$, $g$ and $c$ and constants. What is the first order ODE and how do I do it?
1
vote
0answers
207 views

Minimizing Sum of Least Squares in Matlab

I am working on this minimization problem for image warping that I want to solve in Matlab: Each feature $p$ can be presented by a 2D bilinear interpolation of the four vertices $V_p = [v_p^1, v_p^2,...
2
votes
1answer
57 views

How can I compute $\frac{exp(\lambda v_j)}{\sum_{i=1}^n exp(\lambda v_i)}$ in a stable way?

Given an $n$ vector and $\lambda$ > 1e4 I wish to compute this sum $$\frac{exp(\lambda v_j)}{\sum_{i=1}^n exp(\lambda v_i)}$$ for a fixed $j \in \{1, \dots, n\}$. The sum should be less than one, ...
0
votes
1answer
60 views

Maximum likeliood estimation of variances of transformed variables

I use MATLAB's fminunc function in order to find the minimum of a negative log-likelihood function $f(\overrightarrow{\theta})$, parametrized by 3 parameters lets say $\overrightarrow{\theta}=(\beta,\...