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

-1
votes
1answer
216 views

Multiple echo FIR Filter in Matlab [closed]

This is my final homework for the semester, I would be glad if you can help me.
0
votes
1answer
1k views

Evaluating double integrals using monte carlo methods in matlab.

I used the monte carlo method to integrate $\int_{0}^{1}x^2dx$ in matlab. My matlab code was simply the following: A=1; N=10000; s=0; for i=1:N x=rand; y=rand; if y<= x^2; ...
1
vote
1answer
286 views

Determine frequency response from impulse response

I'm studying signal processing, using MATLAB to plot filter responses. So far, I understand I can use the impulse response to apply a filter to a signal. For example, the impulse response of an ...
0
votes
0answers
30 views

I was wondering if there was a way to plot a vector field and a 3d surface in the same window

I want to plot the vector field $$\textbf{F}(x, y, z) = \sin(xyz)\textbf{ i }+ x^2y\textbf{ j }+ z^2e^{x/5}\textbf{ k }$$ And the surface (part of elliptic cylinder) $$\textbf{r}(u, v) = u\textbf{ i ...
0
votes
1answer
34 views

Function with 2 outputs

I have written the following code: function [ z,a ] = complx( numb ) z=abs(numb); a=angle(numb); end but I get back just z and not a
-2
votes
1answer
363 views

Matlab optimization toolbox vs. CVX solver?

I would like to know what is the difference between the Matlab optimization toolbox and CVX solver which is a convex optimization toolbox? Can a convex optimization be solved in both?
1
vote
1answer
232 views

Simpson's composite rule rate of convergence.

Hello I have wriiten a program in Matlab that determines an Integral using Simpsons rule and it also determines the rate of convergence. I tried my program on the following examples: $f(x)=\sin{ x}$ ...
1
vote
0answers
68 views

Bode plot of an unstable system?

I am a bit confused on how to sketch a bode plot for an unstable system? (being a/all pole(s) lies on RHP). I tried plotting it in matlab, but it doesn't resemble the output i was expecting using ...
0
votes
1answer
1k views

MATLAB: Plotting the inverse Fourier transform of a rectangular pulse.

I'm trying to repeat the results in the image below without using the rectangularPulse(a,b,z) function: Here is my unsuccessful attempt: Here is the code I used to create the first image: ...
1
vote
1answer
118 views

Cyclotomic Cosets and Minimal Polynomial for 45

Currently I am working on matlab in order to find Cyclotomic Cosets for 45. As 45 in not in the format of 2^m-1, matlab give me an error. I am trying to write algorithm in matlab/octave for my ...
7
votes
1answer
411 views

Fast algorithm for approximating Eigenvalue distribution of large sparse matrix

I am interested in the eigenvalue distribution of a huge $2^{16}$x$2^{16}$ Hermitian sparse matrix with spectrum contained in $[-1,1]$. That is I don't need to know all eigenvalues exactly, but rather ...
1
vote
1answer
675 views

arc length parameterization of planar curve in Matlab

Let $\gamma (t)$ be a planar curve parameterized by time $t$. For fun, let it be a limacon. In Matlab $\gamma (t)$ looks like this. ...
0
votes
2answers
96 views

Numerical precision of product of probabilities (normal CDF)

I'm trying to calculate $\prod_k{p_k}$ where $p_k$ are (potentially) very high probabilities of independent, zero-mean, standard normal random variables and $k>100$. However, I'm running into ...
1
vote
1answer
283 views

Solving Differential Equations theoretically and using matlab

i am trying to solve the initial value and elliptic boundary value problems below. but now i need some help solving them using matlab. for the elliptic problem, any method is ok, but for the initial ...
1
vote
1answer
282 views

Find the sparse representation in matlab

I have a dictionary(Matrix) D and an input(Vector) Y. Now I want to solve this problem: What is the Sparse Representation of input Y according to dictionary D. this problem is an important question ...
1
vote
3answers
1k views

Using loop to approximate pi (Monte Carlo, MATLAB)

I've written the following code, based on a for loop to approximate the number pi using the Monte-Carlo-method for 100, 1000, 10000 and 100000 random points. ...
0
votes
1answer
94 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
161 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
93 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
100 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
637 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
47 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
186 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
79 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
187 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
54 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
109 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
240 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
158 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
992 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
806 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
130 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
54 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
152 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
591 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
376 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
296 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
59 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
57 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
106 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
34 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
128 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
171 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
20 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
182 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
214 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
51 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 ...