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

Plot as you go in MATLAB

I'm self studying some numerical analysis and I'd like to get a feel for how an ODE solver speed varies as you move forward in time. Is it possible to use matlab to numerically solve an equation ...
0
votes
2answers
159 views

Solving 2nd degree ODE with Euler method in MATLAB

I am trying to solve the equation below; $$\ddot{x}= -x + sin(t)$$ by the initial conditions; $$x(0) = 0 \\ \dot{x}(0)= 0$$ my MATLAB code is as follows: ...
1
vote
0answers
85 views

Calculating MSE for two different size matrixes

I have two $2$-column matrixes, one of the has $467$ rows while the other one has $61468$ rows. Both them are trajectory paths of same robot, the big matrix is kind of raw data and the smaller one is ...
1
vote
2answers
96 views

trigonometric interpolation of a sampled signal

Given N sampled points, using the FFT we can get the Fourier transform of those N points $X_k$. With N/2 the Nyquist frequency and $X_0$ the DC value. Using the inverse we can then get back the ...
1
vote
3answers
602 views

Calculating own dft via matlab?

We are asked to code our own dft function from the formula : If everything is done correctly it should give the same result with matlab's own dft function, in the end I'm comparing them but they ...
2
votes
0answers
46 views

Error on integration

I'm trying to compute and plot the following integral: $$\int_0^\pi d\theta \int_0^{2\pi} \left( {\cos\theta \sin\theta(x-\sin\theta \cos\phi)\over (1+x^2-2x\sin\theta ...
1
vote
0answers
179 views

Numerical solution of non-linear differential equation with MATLAB

I need some information to know if I can solve a nonlinear integral equation with terms $ u_{x} $ , $ u_{x}.u_{y} $ , $ u_{xx} $ , $ u_{xy} $ $u_{yy} $ $ u_{x}^{2} $ $ u_{y} ^{2} $ By numerical ...
1
vote
2answers
75 views

Matlab function to calculate

How can I input the two functions from this task in matlab ? A voltage peak in a circuit is caused by a current through a resistor. The energy E which is dissipated by the resistor is: ...
1
vote
2answers
167 views

Could anyone explain how is this Matlab code for log likelihood of Gaussian distribution implemented?

I was implementing Expectation-maximization algorithm for gaussian mixture module. However I realized my implementation has very bad accuracy. Then I found some code on internet. It seems this ...
1
vote
0answers
51 views

Matlab: Calculate Lagrange interpolaton polynomial

I'm new to Matlab so I don't even know where to start. I need to calculate Lagrange's interpolation polynomial of some function f in the case when the nodes are ...
1
vote
0answers
100 views

Drawing root locus diagram using Matlab

I am having some problems (or so do i think) making matlab draw a root locus diagram of closed loop system. I have this close loop transfer function $T(S) = \frac{\frac{K_p}{s(s+1)} + ...
1
vote
0answers
216 views

random nonsingular matrices using matlab

Does anybody know how to generate a random nonsingular matrices using matlab? I use sprand (m, n , dens, 1)function to specify the condition number to be 1 right now.But it is too slow.Is there any ...
1
vote
0answers
29 views

plane wave move out

I have a plane wave that is recorded by a set of receivers with x spacing between them (see the sketch). in the sketch (plane wave in black slant line, receivers are the little circles in black and ...
2
votes
2answers
143 views

LSQR with matlab

I am trying to use LSQR on matlab to solve a linear equations: $$ aX + bY = Z $$ so I form [a b][X Y]' = Z where a, b and ...
0
votes
1answer
905 views

Calculating translation value and rotation angle of a rotated 2D image using MATLAB

I have two images which one of them is the Original image and the second one is Transformed image. I have to find out how many degrees Transformed image was rotated using 3x3 transformation matrix. ...
1
vote
1answer
776 views

Richardson Extrapolation Matlab Code: Example and try out code included.

currently I am studying Numerical Methods in Matlab and I need a Matlab code which would calculate Richardson Extrapolation using data given in a table, respectively for x and f(x). For example: Use ...
1
vote
1answer
117 views

Solving Trignometric Transcedental equations in Matlab

I need a little help solving these eqns using Matlab. phir and delr values are required. ...
0
votes
1answer
52 views

remove repeated rows on matlab

I have a $n\times 2$ matrix as the following example 1 21 3 23 3 23 1 21 6 24 6 24 6 24 and I need obtain a new matrix (with 2 columns) with non ...
0
votes
1answer
144 views

Partition a set into n subsets with elements with sum equal to m

For example, given the set $a_n = \frac{n}{20}$ for $\,n \in \{1,\,2,\,\dots,\,19\}$, I would like to get all possible partitions of this set in 4 subsets such that the sum of their elements is always ...
1
vote
0answers
565 views

2D elastic collision using Matlab

I recently started using Matlab and am modeling hard spheres in 2D. I have n particles, their positions are given by two arrays x(n,1) and y(n,1). The simulation has N time steps. I set up a distance ...
0
votes
1answer
359 views

Back calculation of simple Haversine formula

I have coded the simple Haversine formula (matlab) and it works fine (see below). If I provide 2 sets of latitude/longitude I can find the distance between them. Despite this, I need to invert the ...
4
votes
1answer
272 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 ...
0
votes
1answer
56 views

Query regarding phase of analytic signal.

Using the following matlab commands, phase of analytic signal can be obtained. sig_a = hilbert ( sig ) ; ph = atan(angle(sig_a)) ; As for as my understanding is angle(sig_a) will give phase of ...
0
votes
1answer
56 views

How to do projections of data in MATLAB?

How to project a matrix e.g $$A = \begin{bmatrix}2& 5& 4\\ 3& 8& 9\\ 12& 11& 5\\ 4& -7 &8\end{bmatrix}$$ and get the vector_of_projected_points (VPP) onto the ...
1
vote
0answers
91 views

How to find change points in a graph on matlab

I have a graph like this I need to find points at which sudden changes happening for the DPC Time Curve. We can observe that at time 20 and around 70 increase is happening. How to do this in Matlab. ...
1
vote
0answers
14 views

efficiently solve for values of a coefficient in a function, so for those values, the function intersects another function a specific number of times.

This is my summer assignment for my freshman "Intro to Numerical Methods with Matlab: Unit 2" course. The task: "Write an efficient Matlab code, which will take any closed $f(x)$ and $g(x)$ and ...
2
votes
1answer
46 views

How can I plot this?

Given a bunch of data $x_i$ , $y_i$, how do I plot $$f(\theta_2,\theta_2)= \frac{1}{2M} \sum_{i=1}^{M} (\theta_1\cdot x_i -\theta_2 y_i)^2$$ in matlab? I know it should be parabolic, but my code ...
0
votes
1answer
33 views

Matlab iteration

$p,q,e$ and $m$ are known $n=p \times q$ $c=m^e \mod n$ I want to get the $j$, when $c=c^{e^j}$ What am I doing wrong? ...
1
vote
0answers
124 views

Numeric solution of third order ODE

I need to solve the following third order (non-linear) ODE by numerical methods: \begin{equation}\tag{1} h^{3} \dfrac{d^3 h}{d x^3} = h-1. \end{equation} By assumption, the solution should approach $ ...
1
vote
1answer
161 views

Improving the mean squared error of the ordinary least squares solution

I have the following relationship that holds: $y = a x_1 + b x_2$ Now I would like to determine constants $a$ and $b$ by performing tests. Each test results in 10 values for $y$, $x_1$ and $x_2$. ...
0
votes
1answer
19 views

Use control parameter to set volatility of discrete distribution

I am trying to control the volatility in a simulation, and though I finally thought of a solution after writing this complete question, I would prefer a simpler solution that does not generate too ...
1
vote
0answers
172 views

Intersection between sphere and ellipsoid

I am failing since two days to compute and to plot the intersection of an ellipsoid in parametric notation ...
0
votes
1answer
206 views

help me 'Matlab' for bisection method.

Pb1) use a matlab. Graph the function $$f(x) = 32x^6 −48x^4 +18x^2 −1$$ on the interval $[−1, 1]$ and find all roots of $f (x) = 0$ accurate to within $\varepsilon = 1e−10$ by using the bisection ...
0
votes
0answers
48 views

find relevant statistical distribution of data

i would like to find maximally relevant statistical distribution of sinusoidal data,for example let us consider following model ...
1
vote
0answers
711 views

Change MATLAB code from Lax-Wendroff to Leapfrog

I want to see how leapfrog would look using this code, but I'm having issues implementing it. I think my biggest problem is adding in the $ U_j^{n-1}$ term, I just don't get the logic. Here's what ...
1
vote
2answers
93 views

How to plot not only the result but also the derivatives of an ode using the ode45 function in Matlab?

I have already successfully run a code for the simulation of the deflection of beams under different loadings. I used the Matlab program and the ode45 solver for Initial value Problems and bvp4c ...
1
vote
1answer
941 views

Median of Medians in 2D Array/Matrix

This is a bit of a mathematics problem, and a MATLAB problem. In MATLAB, if I call median(M), where M is an ...
0
votes
2answers
113 views

Numerical Differentiation using Numerical Methods

I am currently studying Numerical Differentiation in MATLAB using Numerical Methods in Engineering with Matlab by Jaan Kiusalaas, and I am stuck at exercise 13 from Problem Set 5.1 from Chapter 5 ...
3
votes
0answers
317 views

The definition and meaning of “machine epsilon” in MATLAB

I am taking a introductory course in numerical mathematics, using MATLAB and a numerical math text that refers to MATLAB often. In the text, the machine precision is defined as: The distance ...
0
votes
1answer
37 views

What is wrong with this algorithm [closed]

Crout factorization: n=10 A = full(gallery('tridiag',n,-1,2,-1)) i = 2:(n-1); bmid = i.^2 / ((n+1).^4) b = [1+1/(n+1)^4, bmid, 6+(n^2)/(n+1)^4]' for i = 1:n L(i,1) = A(i,1) end for j = 1:n U(1,j) = ...
1
vote
0answers
49 views

Turning a summation into an integral

I have a summation of the form: $$y(x) = \sum\limits_{h=-L}^L\frac{A(h)\cdot R(h)^2}{((x-h)^2+R(h)^2)^{3/2}}$$ Where I wish to solve/optimise $R(h)$ (leaving $A(h) = const/h$) or $R(h)$ and $A(h)$ ...
0
votes
1answer
82 views

Backward error for Crout factorization

Ok, can someone please tell me what is the formula for the max error in LU decomposition of Crout factorization?
0
votes
2answers
39 views

How to write this b in matrix form in matlab?

Can anyone help me write this b in matrix form in matlab? I am letting n=10 for the dimension of A.
0
votes
1answer
6k views

Gauss Seidel iteration in matlab

I've posted this question before for crout factorization. Now, I need help with Gauss-Seidel iteration. Write a program that takes a value for n and solves for x using the following method: ...
2
votes
2answers
9k 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 ...
0
votes
1answer
594 views

convex hull function in matlab

Is there any way 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 ...
1
vote
0answers
45 views

Matlab functions of variables

So I am writing a function to compute the following equations for an SIR model: So here's my code: ...
0
votes
1answer
369 views

Matlab using subscript variable

I'm trying to write a function in matlab but I don't quite know if it is working. In the equation line i have: xdot(2) = N_h * x; to signify: $$\frac{dy}{dt} = ...
0
votes
1answer
296 views

Matlab Cropping Plots

I want to adjust the amount of whitespace that is shown when plots are generated. I found this command to do just that: ...
1
vote
0answers
59 views

analog BANDPASS filter difference equation

does anyone know what is the difference equation for band pass filters in terms of bandwidth,low frequency,high frequency.... I'm trying to design a band pass DISCRETE filter using Mat lab !