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

Select certain elements from a vector array MATLAB

I am new to MATLAB. I have an array consisting of real numbers. I want to select the elements that are closest to integer values. I want one element per integer. I am using the "if" statement and ...
0
votes
0answers
16 views

How to make a $4 \times 6$ matrix from a $6 \times 6$ diagonal matrix in MATLAB

I am having a diagonal matrix A = diag(a,b,c,d,e,f) which is a $6 \times 6$ matrix. From this I want to make $4 \times 6$ matrix specified by: ...
0
votes
0answers
14 views

How to show remaining time in timer clock matlab on pressing ESC? [migrated]

I have a program given i want to show the time remains when pressing ESC in stopwatch so anyone help me in this program i want to show the time remains after pausing stopwatch in dialog on pressing ...
1
vote
1answer
20 views

More efficient algorithm for matrix rearrangement (MatLab)

Say I have the following matrix: $$A = \begin{bmatrix}0.1 & 2 \\ 0.1 & 4 \\ 0.1 & 6 \\ 0.2 & 3 \\ 0.2 & 2 \\ 0.2 & 7 \\ 0.3 & 10 \\ 0.3 & 7 \\ 0.3 & 5 ...
3
votes
1answer
42 views

Probability of True Positive of a random variable defined by an integral expression

$\newcommand{\Prob}{\operatorname{Prob}}$Let's assume that we have a random variable with the following pdf: \begin{equation} f_T(x) = \int_0^\infty f_T(x,g) \cdot f_{g}(g) \, dg = \int_0^\infty ...
3
votes
1answer
306 views

Plotting discrete time signals involving sumations in matlab.

Many of the examples I've encountered while looking for an answer are simple functions that do not involve summations. Suppose I have the following function; ...
2
votes
0answers
21 views

Distribution of $f(x,|h|)$, being $|h|$ rayleigh distributed

INTRODUCTION Let's supose we receive the following signal: \begin{equation} y[n] = hx[n]+W[n] \end{equation} where: $x[n] = Ae^{j2 \pi f_c t}$ is the transmitted signal $f_c$ is the carrier ...
0
votes
1answer
2k views

find equilibrium points in matlab

I need help with this material: The dynamics growth of two populations is expressed by the system of equations: ($x=$ prey, $y=$predator, $0 \leq t \leq 30$) $$\dot ...
-4
votes
0answers
24 views

Matlab code for two variables [on hold]

I want to code this function in Matlab: $$ Y=5+e^{-2t}\sin(2x)+7x $$ So for my code is: ...
0
votes
1answer
29 views

Rain forecast model and least squares

Good evening everyone, I'm trying to create a rain forecast model, I have about 720 data, which correspond to monthly rainfall in 60 years during the 12 months of the year. I have a matrix ...
2
votes
0answers
28 views

Classifying peak and valley *regions* of a histogram

I've been playing with a few ways of classifying contiguous regions of a histogram as: 1) peak, 2) valley, or 3) in-between bit. Global thresholding has worked minimally well for me so far, but I'm ...
-1
votes
0answers
10 views

Matlab upper triangular matrix with identical column entries [on hold]

I want to create a matrix in matlab where the first column is one entry then zeros, second column is two of the same entries then zeros, third column is three of the same entries then zeros, etc. ...
-1
votes
0answers
15 views

How can I create in an orderly fashion, several matrices of varying size in Matlab? [on hold]

Say I have an nx3 matrix and I want to split it up into k different matrices based on the value of the 3rd column. (before running the program I don't know how many different values can be in the ...
0
votes
0answers
82 views
+50

updating of the cholesky decomposition

I try cholrank1 update (wikipedia) of the symmetric positive definite (SPD) matrix . ...
-3
votes
0answers
49 views

Can you teach me how to solve this problem? [closed]

$\newcommand{\randn}{\operatorname{randn}}$ I am studying Linear Algebra by myself with '"Introduction to Linear Algebra, 4th Edition" written by Gilbert Strang. I am trying to solve all of the ...
1
vote
0answers
21 views

Cyclic Redundancy Check of an input sequence using MATLAB

I understand how to mathematically calculate the cyclic redundancy check CRC of bits, for example if the CRC is of length 16 $$ CRC(D) = (M(D) + I (D)) D^{16} \,\,\, mod \,\,\,\ G(D)$$ where $M(D)$ ...
1
vote
2answers
26 views

Randomly choose any number of elements within a given sample randomly

If I want to arbitraraly choose any number $(1\sim9)$ of arbitrarily elements within $(1\sim9)$: Ex: 1. $n = 3$ (randomly) $\rightarrow$ choose $"1,4,9"$ (randomly & no repeat) 2. $n = 2$ ...
0
votes
0answers
18 views

A maxdet problem with three variables - how to solve by hand or by Mathlab/Mata?

Problem Given $n$ known vectors $y_j = (y_1, y_2, ..., y_{K_j})', \forall j=1,n$ and a constant $K$; determine three vectors ($\alpha, \beta, \theta^2)$ that maximise: $$ \text{T} = ...
2
votes
0answers
21 views

What is a stochastic differential equation of the form $dZ = f(Z_{prev}, X_{prev})dt + CdW_t$ called?

At every time step I can approximate the change in $Z$ using the following equation: $$ dZ = f(Z_{prev}, X_{prev})dt + CdW_t, \quad(1)$$ $$dW_t = r\sqrt{dt}$$ where $C$ is some constant, and $r$ is ...
0
votes
1answer
301 views

Overlaying scatter points over world map in MATLAB

I am facing difficulty overlaying lightning location data over a region of the world map. I have lightning location data where the first column contains longitude and the second column latitude. I ...
3
votes
3answers
4k views

Kendall tau calculation

Can someone explain how the Kendall tau works? I can't seem to find a good explaination/tutorial/example. I've been running corr(x,y,'kendall') from Matlab's ...
0
votes
0answers
13 views

Probability of a Random Sequence [closed]

So I was making this program in MATLAB for fault detection. I get a residual vector which I have to further test using Sequential Probability Ratio Test for which I should know the Probability ...
0
votes
1answer
27 views

Finding arctan with Euler

I am asked to find $y(t) = \arctan(t)$ using forward Euler method for $t=1,$ using initial condition. There is exact solution, but I need to approximate using methods such as Euler and Runge Kutta. ...
1
vote
0answers
30 views

How should I modify the initial guess for normalised version of an optimisation problem?

I am solving a large optimisation problem. The problem contains 500 decision variables and few hounderd constraints. Since the constraints are very tight and nonlinear, any random initial guess ...
0
votes
1answer
414 views

One strange way to generate b-spline base

I am trying to use curve fitting under Matlab. There are two kinds of spline in Matlab: piecewise polynomials and b-spline. For b-spline, we know that the basic functions can be derived by means of a ...
2
votes
1answer
3k views

Solve a second order DEQ using Euler's method in MATLAB

I need to solve the equation below with Euler's method: $$y''+ \pi ye^{x/3}(2y' \sin(\pi x)+\pi y\cos (\pi x)) = \frac{y}{9}$$ for the initial conditions $y(0)=1$, $y'(0)=-1/3$ So I know I ...
0
votes
1answer
26 views

Numerically solving equations with expectations

I have a equation $\mathbb{E}_\theta f(x,\theta)=a$, where $\theta$ is a vector real random variable with a known distribution, $a$ is a real constant, $x$ is a real (can be vector valued) variable. ...
0
votes
0answers
15 views

FFT differential equations

Given a generical differential equation what is the procedure to solve it using fft command. Can anyone explain me how to do it? For example: $$\frac{d^2y}{dt^2}+10\cdot \frac{d\:y}{dt}=-5\cdot ...
1
vote
0answers
21 views

Matlab, Extracting Particular Values from an Excel File

If I have a table of values in Matlab ( here I have a 40k rows, and about a dozen columns), how can I read only particular values from each row? My goal is to extract some of the values from each row, ...
-1
votes
1answer
27 views

What is transpose multiplier and forward multiplier?

For linear system X = A*s, we define the forward and transpose multiplies Af and At as follows: Af = @(s) A*s; At = @(s) A'*s; I want to know what is forward ...
1
vote
1answer
2k views

Difference equations and Matlab (some working)

The difference equations below model the yearly populations of wolves and moose, measured in hundreds. The wolves kill the moose for food. $$\begin{align} ...
2
votes
4answers
58 views

Inverse Chebyshev Recurrence

The Chebyshev polynomials (of the first kind) are a sequence of polynomials defined recursively by $$ \begin{cases} T_{0}(x) = 1 \\ T_{1}(x) = x \\ T_{n}(x) = 2xT_{n-1}(x) - T_{n-2}(x) \end{cases} $$ ...
1
vote
0answers
34 views

Please help: My MATLAB code for solving a 2D Schrödinger equation keep giving me weird output.

I've been trying to solve the following Schrödinger equation numerically, \begin{equation} -(\frac{\partial^2}{\partial y^2} + \frac{\partial^2}{\partial z^2})\Psi + \frac{\sinh^2(y) + ...
0
votes
2answers
821 views

How to calculate the hessian of a matrix function

I am estimating a model minimizing the following objective function, $ M(\theta) = (Z'G(\theta))'W(Z'G(\theta))$ $Z$ is an $N \times L$ matrix of data, and $W$ is an $L\times L$ weight matrix, ...
0
votes
1answer
306 views

Gaussian distribution and its parameters

I need to learn more about Gaussian distribution and given a set of data, plot a Gaussian distribution of it. Using the following code sample, could you please tell me how I can plot a Gaussian ...
2
votes
2answers
74 views

How to find nonnegative solutions of a linear system?

I have a $M$ equation and $N$ variables like this : $ \begin{bmatrix} 3 & 0 & 1 & 0 & -1 & -3 & 2\\ 1 & 2 & 0 & 4 & 0 & 0 & -1\\ 1 & 1 & 0 ...
3
votes
1answer
88 views

Fun/Frustration With Coding Coding Theory

it's time for practical coding theory. I am trying to write a simple program that will detected if a given binary code word is "correct" or not. If it is not correct, I want to detect/correct (since ...
2
votes
2answers
2k 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 ...
0
votes
0answers
20 views

Solve first order BVP on MATLAB

I try to solve this equation on MATLAB $$y^\prime(x)=x+y^2(x)\quad\forall x\in(0,0.9),\quad y(0)=1, y(0.9)=32.725$$ I write two function on matlab, on myODE.m file, ...
0
votes
1answer
23 views

Matlab declare function with two different behaviours [closed]

I'm struggling in finding a way to declare a function with two different behaviours in the following way: $$f(x) = \begin{cases} \frac{\sin(x)}{x} & \text{if } x \neq 0, \\ 1 ...
0
votes
3answers
1k views

Using MATLAB to find the max elements and their positions [closed]

MATLAB documentation says "[C,I] = max(...) finds the indices of the maximum values of A, and returns them in output vector I." But that does not seem to work. See below. X = [2 8 4; 7 3 9]; ...
1
vote
0answers
16 views

Two-sample Kolmogorov-Smirnov test for binary groups

I am using Kolmogorov-Smirnov test for selecting data that distinguishes two groups. I have defined the group with the binary variables (0 and 1). group = [1 0 1 1 1 0 0]; x =[2 3 4 5 2 -1 1]; I ...
0
votes
1answer
27 views

Convolution in Matlab with different “sampling”

I am trying to figure out how to "normalize" the convolution that Matlab does (using the "conv" operator). If I have a rect function with spacing T and I do the convolution of that function with ...
0
votes
0answers
13 views

How to solve in matlab for B in this linear problem?

I have been trying to figure out how to solve the following linear problem: (S')(B)(S)=1 where S is a Nx3 matrix This is part of the procedure for estimating surface normals in Photometric stereo. I ...
1
vote
1answer
314 views

Matlab: need help with optimization

I am trying to minimize the objective function over [x(1),x(2)]: exp(x(1))*(4*x(1)^2+2*x(2)^2+4*x(1)*x(2)+2*x(2)+1)+b subject to constraint ...
0
votes
2answers
34 views

Integration of a function that is numerical solution of differential equation

I've obtained a numerical solution of a differential equation in a form of a vector (i.e., M(170,1)) by using ode45 (MATLAB) and ...
0
votes
2answers
33 views

Why does my answer depend on the starting values?

I'm trying to find the zeros of f(z)=c(z)-2500=0 using the secant method. I get the correct values (8.9, -2.6, 7.7, 12.3) but only if I put the starting values close. For instance this version of the ...
0
votes
0answers
24 views

Fourier and MATLAB/simulink

I have been using pencil and paper to calculate the amplitude spectra of a unipolar square wave of amplitude 1v and frequency 2000Hz. I have used Fourier series to calculate the amplitudes of various ...
1
vote
2answers
9k views

How to determine if a matrix is positive/negative definite, having complex eigenvalues?

I am trying to deal with an issue: I am trying to determine the nature of some points, that's why I need to check in Matlab if a matrix with complex elements is positive or negative definite. After ...
1
vote
0answers
35 views

Matlab Optimization problem with Matrices

I'm trying to solve an optimization problem in Matlab. The expressions you will find below. Problem is it is all matrices, and I have no idea which solver to use for that. $w$ is of size $n \times 1$, ...