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
vote
0answers
19 views

Matlab double integration result does not match with my self calculate

Here is a double integration, self learning $$ P=\int_{-w}^{w}\int_{l}^{\frac{y_h(x_b+w)}{x_h}+l}\frac{1}{2}\operatorname{erfc}\left[\frac{\log{\frac{z_h(y_b-l)}{y_h}}-\mu}{\sigma\sqrt2}\right]\space ...
0
votes
0answers
9 views

How to crop a matrix/array based on a condition [on hold]

I have a matrix consisting of 10 columns/arrays. First 9 are my data. The 10th column/array is a "trigger channel" which has sharp spikes from baseline 0V to 5V and back down to 0V. I need to crop all ...
-1
votes
1answer
52 views

How to implement twice MATLAB integral build-in function for numeric integration? [on hold]

Suppose we have a function $F(\lambda) = \int\limits_{\lambda}^1 f(x) dx$, where $f(x)$ has no formula for antiderivative. We can easily calculate it by means of build-in MATLAB functions. Let's use $...
0
votes
0answers
26 views

Plotting $\sum_{n\geq 1}\frac{1}{n}z^{n}$ for $|z|<1$ (the natural boundary): Coding

As part of my tutorial, I would like to show the plots of a)$-\sum_{n\geq 1}\frac{1}{n}z^{n}$ and b)$Log(1-z)=log(|z|)+iArg(z)$, to drive home the point of analytic continuation. Plotting the Log is ...
0
votes
0answers
16 views

Help creating Matlab code for iterative method [on hold]

I am new to Matlab programming. I need to use iterative methods to solve the following system of equations with Matlab: ...
0
votes
1answer
28 views

calculating different values of a function in MATLAB [on hold]

i want to calculate different values of $h_j$ for $j = 0$ to $10$ where $\alpha = \beta = \frac {1}{2}$ and $h_j = \frac {2^{\alpha+\beta+1} \Gamma(j +\alpha+1)\Gamma(j +\beta+1)}{(2j +\alpha+\beta +...
1
vote
1answer
18 views

Plotting flux tubes on the surface of a sphere on matlab

I've been given the task to plot two flux tubes on a surface of a sphere, where one of the tubes twists around the other (to model magnetic helicity). I know how to generate a sphere in Matlab, and ...
0
votes
0answers
9 views

Specifying Correlation Within Clusters

So, I am looking to generate data which is correlated at a group level with a specified level of correlation. That is, suppose if I drew a certain number of $y_{ig}$ observations from the standard ...
2
votes
3answers
68 views

Find equation for line segment

I already know that the standard equation for a line is $y=mx+b$, but what if i want the line to have specific endpoints and not go on forever. For example the equation for a line beginning at $(3,1)$ ...
2
votes
3answers
166 views

Minimizing $\|Ax\|_2$ subject to $\|x\|_2 = 1$

I have a Matlab program to estimate a vector $x$ from noisy measurements. I use the singular value decomposition (SVD) to solve the linear equation $Ax=0$ (where the number of equations is greater ...
0
votes
0answers
15 views

How to get best fitting model decision for data X and Y in e.g. Matlab?

I have two sources of data, X and Y, which are basically counts, from 23 individual origins (3D ROIs in my case). For example: ...
0
votes
0answers
7 views

Phase correlation vs. normalized cross-correlation

In 2-dimensional discrete signal analysis (specifically image processing), a definition I found for the normalized cross-correlation between two images, both of size MxN $g_1(x, y)$ and $g_2(x, y)$ is:...
0
votes
0answers
18 views

Design with Matlab the equation of the position of a drone

I want to design with Matlab the equation of the position of a drone which is $u=m(\ddot z_{des}+K_pe+K_v\dot e+g)$ where $e$ and $\dot e$ can be calculated from the current and desired states $(z,...
0
votes
0answers
22 views

How to find the result of a differential equation in Matlab?

Given a variable $x$ defining the position of a drone, $\dot x$, its velocity, how do we find its acceleration $\ddot x$ in mathlab? I know that we can found the solution of a differential equation ...
0
votes
0answers
11 views

what is the ZYZ euler angle representation,(ψ, θ, ϕ), for a given matrix in MatLab?

I want to know using matlab what is the ZYZ euler angle representation,(ψ, θ, ϕ), for the following rotation matrix? \begin{pmatrix}0.6927&-0.7146&0.0978\\ \:0.7165&0.6973&0.0198\\ \:-...
1
vote
1answer
45 views

How to verify that a matrix is a rotation matrix in Matlab?

Using Matlab, I want to know if $$A=\begin{pmatrix} \cos(x) & \sin(x)\\ -\sin(x) & \cos(x) \end{pmatrix}$$ is a rotation matrix. Hence, $$\begin{pmatrix} \cos(x) & \sin(x)\\ -\sin(x) &...
1
vote
1answer
34 views

Generate two matrices such that multiplication of these matrices results a symmetric positive definite matrix

I want to generate a tall&skinny matrix and a fat&short matrix, such that multiplication of these matrices results a symmetric positive definite matrix. My inefficient/expensive solution is: ...
0
votes
0answers
35 views

Delaying signals in Matlab

I'm new to MATLAB and have a question that I need help on: The problem I have is to plot the simple signals: a 1Hz Sine wave, a standard rectangle function and a standard triangle function Here is ...
0
votes
1answer
24 views

MATLAB: how to include running time on a graph? [closed]

I have a MATLAB/Octave program for which I used the tic and toc functions to measure the time elapsed for some calculations. e.g....
0
votes
0answers
13 views

Matlab for the joint distribution

I calculate one joint distribution function, and hope to implement it in Matlab. The function is a little complex: $$F_X(x)=P\left(\frac{z}{1+y}\leq x\right)= \int _{0}^{\infty}F_{Z/Y}(x(1+y))P_Y(y)...
0
votes
0answers
9 views

Optimize linear function with integral as a constrain

How can I solve a linear optimization problem with an integral as a constrain? I am looking for a Matlab toolbox. My optimization problem is: $\max_{\alpha} \sum_{k=1}^K \alpha_k \cdot x $ such that ...
0
votes
1answer
92 views

What is the value of $e^{-10000}$?

What is the value of $e^{-10000}$? We know that the function $e$ does not attain value $0$ anymore. But in R and Matlab the value of $e^{-10000}$ is given as $0$ which is not correct anymore. I ...
0
votes
0answers
14 views

How to Plot Silhouette with Sørensen–Dice Similarity Coefficient

How to plot silhouette with Sørensen–Dice similarity coefficient? I already have the cluster result and distance value. clust: 1 1 2 2 2 metric: ...
0
votes
1answer
48 views

Algorithm for getting consecutive line segment edge points from midpoints

So I have a rectilinear grid that can be described with 2 vectors. 1 for the x-coordinates of the cell centres and one for the y-coordinates. These are just points with spacing like x spacing is 50 ...
0
votes
1answer
18 views

How would you take advantage of the knowing the zeros in T, a tridiagonal matrix, in a code for Gaussian elimination?

When $T$ is tridiagonal, its $L$ and $U$ factor have only two nonzero diagonals. How would you take advantage of the knowing the zeros in $T$, in a code for Gaussian elimination? Find $L$ and $U$. $$...
0
votes
0answers
12 views

Did I implement a log-normal distribution incorrectly?

I have a bunch of data relating to the lengths of certain objects. I found out that the log of these lengths are somewhat normally distributed, so I used a lognormal distribution to approximate the ...
1
vote
3answers
33 views

Creating nearest neighbors Laplacian matrix

I want to create a general formula for an $N \times N$ nearest neighbors Laplacian matrix such that I can write an mfile in MATLAB to compute the matrix for given $N$. The nearest neighbors Laplacian ...
2
votes
0answers
158 views

Least-squares problem with quadratic equality constraint

I want to find the solution of a Lagrange equation whose inputs are matrices. First I have the equation Ax=0. By decomposing $A$ into $A_3$ (columns 9 to 11 of A), $A_9$ (the rest of the columns), ...
-1
votes
0answers
17 views

Inital condition for 1st order derivative

I have a PT2 system filter, Y'' = (a0)*Y'+(a1)*Y+(b)*u. I want to apply this filter to my signal, i have a problem in deriving ...
1
vote
1answer
25 views

type of the noise: PDF+Hypothesis test

I have a 2D matrix of values. I've considered these values as a noise. What I'm trying to do is to draw the PDF of my matrix and see the distribution of my data. But it is not enough to say that ...
0
votes
0answers
11 views

Maximum Likelihood estimator Matlab

Hello im having trouble to find the maximum likelihood estimator r using the Newton-Raphson method in MATLAB (while$\left| {{r}_{n+1}}-{{r}_{n}} \right|<{{10}^{-6}}$) where$G(r)=\ln (r)-\frac{\...
2
votes
0answers
61 views

How to decompose a 2d shape into sin and cosin modes?

Assume that you have a circle with radius $r_0$, then you keep adding cosine modes as below: $r=r_0+a_1\cos(1\theta)+a_2\cos(2\theta)+a_3\cos(3\theta)+a_4\cos(4\theta)+~...$ if you plot this as ...
0
votes
0answers
7 views

How to plot a sine function with changing pulse width? (PW values are obtained from an array.)

I am trying to plot a sine signal with it a varying PW. I defined PW as the duration of the pulse of I am generating. (The entire signal consists of 5 pulses separated by delays (i.e. arrays ...
2
votes
1answer
18 views

Matlab - set like datatype?

I'm need to work with Matlab again but it's long ago that I did so the last time. So I need your help (searching for "set" leads only to how to set colors of axis and so...). How can I achieve a set ...
0
votes
0answers
16 views

Calculation of an FIR filter in Matlab.

I have been researching FIR filter design with regard to my signal processing assignment and am having a lot of difficulty trying to understand how the frequency response and ultimately the magnitude ...
0
votes
0answers
20 views

2d Heat Diffusion Matlab

I am working on a 2d heat diffusion problem. I have to find the bottom boundary node equations. I am familiar with a mixed approach scheme to the 2d diffusion problem however the code provided does ...
0
votes
0answers
15 views

Determining the effect of a constant magnitude on a Runge Kutta solution

I have a 1st order PDE that ultimately requires a runge kutta solution. the formula is: $$\frac{Dr}{Dt}= k_0\left(\frac{1}{r^4}\right)\cdot t$$ Ultimately the runge kutta solution is an intermediary. ...
1
vote
1answer
64 views

Solving Fourth-Order ODE BVP using dsolve()

I'm attempting to solve the following ODE using Matlab's built-in function dsolve $$\frac{d^4w}{dx^4}=w$$ with the following boundary conditions: \begin{align} \frac{dw}{dx}(0)&=0\\ \frac{d^3w}{...
0
votes
0answers
31 views

Triangulation with two camera setup - Result in world or camera coordinate system?

I have some problems to understand how I can triangulate a 3D-point using a two camera setup. Let's assume I'm using a right handed coordinate system and the camera is looking in positive z-...
0
votes
0answers
29 views

recursive least squares for nearly singular matrices

I have an image reconstruction problem which I want to solve as a linear system $Ax=y$. A matrix is big, but for the beginning I can shrink the imaging region to $nPix$ = 2000 pixels. number of ...
0
votes
0answers
7 views

Mixed convection - Matlab

So I am trying to solve the following mixed convection problem in Matlab: for $x=0: u=v=0, T=Th$ (heated wall); for $x=L: u=v=0, \frac{\partial T}{\partial x}=0$; for $y=0: u=v=0, \frac{partial T}{\...
-1
votes
0answers
28 views

Gauss- Legendre and Simpson's rule for a double integral in MATLAB

I'm trying to resolve $$f(x,y)=\int_{0}^{1}\int_{0}^{2}e^{-xy}dxdy$$ with Gauss- Legendre quadrature and Simpson's rule, but being honest I have no idea how to write it on MATLAB. So, that's my ...
1
vote
0answers
4 views

Hurst exponent Algorithm not well defined? What to do in this case?

The R/S algorithm is well known for finding the Hurst component of a given data set. I have one query about whether it is well defined? Suppose in a given partition, all of the values were equal to ...
0
votes
1answer
75 views

Ball motion with air resistance coupled differential equation for fourth-order Runge-Kutta

I've created a MATLAB function for solving coupled differential equation with the fourth-order Runge-Kutta method based on what is provided here (Simultaneous Equations of First Order). Here the ...
0
votes
1answer
18 views

How to expand the matrix in Matlab (forming $A$ matrix in least square problem)

If I have 5 data points (actually, this could be vary huge number): $a = [1;2;3;4;5]$ To each data point, I can form a matrix $[a(i),2a(i)]$. (actually, I have to find the matrix, this matrix needs ...
2
votes
2answers
34 views

How do I build this band matrix in MATLAB?

I need to build a pentadiagonal matrix in MATLAB like this: $\begin{pmatrix} 1+2\lambda & -\lambda_1 & 0 & -\lambda_1 & 0 & \cdots & 0\\ -\lambda_1 & 1+4\lambda_1 & -\...
0
votes
1answer
46 views

Numerical integration in Matlab (Gaussian 3 point quadrature)

Write a Matlab function that applies the Gauss three point rule to N sub-intervals of $[a, b].$ The input parameters should be the name of the function being integrated, $a, b,$ and $N$. Attempt: ...
2
votes
4answers
112 views

Monte Carlo double integral over a non-rectangular region (Matlab)

I want to evaluated the following integral using Monte Carlo method: $$\int_{0}^{1}\int_{0}^{y}x^2y\ dxdy $$ What I tried using Matlab: ...
0
votes
1answer
18 views

MuPAD: plot sum of list elements

I am receiving an unclear error when trying to plot partial sums of elements of a list in MuPAD. Any suggestions would be appreciated. ...
0
votes
1answer
41 views

Solve $Ax=b$ for $A$ in MATLAB

I have this linear system $$\begin{bmatrix} cY(t-1)\\ acY(t-1) - acY(t-2)\end{bmatrix} = T \begin{bmatrix} Y(t-2)\\ Y(t-1)\end{bmatrix}$$ where both $c$ and $a$ are known constants, and I need to ...