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
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
113 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
19 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 ...
0
votes
0answers
22 views

Simplifying MATLAB fraction to make numerator equal to 1

I have a function which returns this fraction, which is not in the needed format. $$\frac{36893488147419103232*z^2}{36893488147419103232*z^2 - 672282507639892864*z + 6656262451880127}$$ I need it to ...
0
votes
0answers
6 views

Mupad Scatterplot operand is invalid

Could someone please explain the following error? I am trying to plot (0,0) and (1,1) on a scatterplot in mupad. ...
0
votes
0answers
27 views

Matlab ODE solving

So I have an ODE that needs to be solved a few thousand times on MATLAB and am wondering what the most efficient method to use would be. I am changing a constant term each time. My ODE is of the form $...
0
votes
0answers
10 views

The difference between awgn(x,snr) and awgn(x,snr,'measured')?

I use awgn function to add noise to my signal modulation to calculate BER. But when using awgn(x,snr), it make the result wrong, but true with awgn(x,snr,'measured'). I read on mathwork, they said ...
1
vote
1answer
15 views

Why equals the z-Transform $c^n * u(-n-1)$? according to Matlab/WolframAlpha?

$x[n] = c^n * u[-n-1]$ Where u[n] is Heaviside step function. According to Matlab and WolframAlpha this equals 0. However if I compute the sum according to the z-Transform definition I got (sum from ...
1
vote
0answers
10 views

Find the 1 dimensional empirical conditional distribution with data

I need to find the the conditional distribution function empirically of some data $C$, given the value of a particular predictor $y$. I have attempted to use Bayes as follows: $$ P(C \ |\ y)=\frac{P(...
1
vote
2answers
42 views

How to check if two sets of vectors span the same space in matlab/python?

In MATLAB/Python, is there a way to compare the subspaces span by two different sets of vectors and check if they are the same?
0
votes
1answer
11 views

Need some help with matlab syntax for logical equivalence/inference

I've got a maths question that I need to translate into matlab syntax to run through and I'm slightly stuck so hopefully someone here can help since I can't seem to find my answer online. The ...
0
votes
0answers
40 views

How to distinguish as Linear or Non-linear constraints

In optimization problem $$\arg\max_{\substack{l_1 \in [0, 1],\cdots,l_{M} \in [0,1]}} T$$ I have $m=1\cdots,M$ constraints such that $$\ln \left[a_m\right] + \ln \left[ \left(\frac{l_m}{l_m + \...
1
vote
1answer
20 views

Covariance matrix - wrong results either in Matlab or in formula?

The definition of a covariance for discrete variables (taken from https://en.wikipedia.org/wiki/Covariance) is: $$\operatorname{cov} (X,Y)=\frac{1}{n}\sum_\limits{i=1}^n (x_i-E(X))(y_i-E(Y))$$ ...
0
votes
1answer
10 views

Find a Weight Function with specific characteristics

I need to build a weight function and I want to understand how you would do that. The reasoning you would use to define it. My function has to be something like: $f(\alpha)$ which is: $0$ if $\...
-1
votes
1answer
17 views

Display the quotient between the value of an histograms

i'm triying to display the quotient of two histograms which have the same borders. Is it possible to do is with Matlab ? Thanks a lot !
1
vote
3answers
68 views

Matlab sum is wrong: Double symsum gives incorrect result

I'm trying to calculate the double sum $$ \frac{1}{10} \sum_{x=1}^{10} \left( \frac{1}{x} \sum_{n=0}^{floor(log_{10}x)} 10^n \right).$$ In MATLAB, my result is ...
0
votes
0answers
12 views

Match harmonics while decoding the speech signal

There is a matlab's program. In the input parameters is a wav file. After executing a program there are appearing an array of frames. Frames partially recover each other. In each frame there are ...
0
votes
0answers
12 views

is it possible to generate random ill-conditioned sparse matrix in MATLAB?

I know how to generate ill-conditioned dense matrices (use 'gallery'). I do not know how to generate ill-conditioned sparse matrices. Anyone help?
1
vote
1answer
23 views

using MATLAB to solve a linear program

Hello I am very new to MATLAB and having difficulty solving a linear program problem using MATLAB, I tried solving it however I am not sure If i did it correctly Use MATLAB to solve the following ...
0
votes
0answers
15 views

How to generate power spectra of AR-1 process in matlab?

I have a time series x1 as 3600x1 double. I need to fit AR-1 spectra on the power spectral density of x1. Well, I am not an expert and this is the first time I am studying time series. If AR-1 ...
1
vote
1answer
34 views

Can integrals be solved using MATLAB's ode solver? [closed]

I was wondering how I could solve a definite integral using a MATLAB ode solver? Thanks!
0
votes
0answers
15 views

Trying to implement an impulse response function in matlab giving wrong results

Hi all I am trying to implement equation of the Johnson Wilson model (used in blood flow analysis on medical images ) below: $$ R_{JW}(t) = u(t) - u(t-T_c)(1-E)\left\{1+\int_0^{t-T_c}(1-E)^{\frac{\...
0
votes
0answers
22 views

Order of Lobatto IIIa Method w.r.t MATLAB's bvp4c/bvp5c

I'm writing an overview about the use of MATLAB's bvp5c boundary value problem solver. In the literature (for example [1], pg 36), it is stated that the Lobatto IIIa methods are order 2s-2 for an s ...
0
votes
0answers
55 views

Linearising a system of ODE's

So I have this ODE: $$x''=\frac{-27}{13}x'+\frac{35}{13x}-\frac{4843}{283}$$ The question asks me to write a MATLAB script to linearise this ODE around any specified x value, as far as I know only ...
1
vote
0answers
21 views

Finding an invertible matrix $P$ such that $P^{-1}AP$ is a Jordan matrix

Find an invertible matrix $P$ such that $P^{-1}AP$ is a Jordan matrix. Is there a way in matlab to find such a matrix $P$ given $A$?
1
vote
1answer
27 views

Discrete Fourier transform implementation giving results that are order of magnitude off

I tried implementing a Discrete Fourier transform in Matlab, but I found my results an order of magnitude off. I used next definition of DFT: $$ F(u) = \frac{1}{2N} \sum^{N-1}_{x=-N} f(x) e^{- \pi i ...
1
vote
0answers
20 views

Interpreting the angle from the angle obtained by atan2 function

I have two signals ($x$ and $y$) whose absolute phases I'm calculating by using the atan2 function. Then subtracting both I'm getting the relative phase between two ...
0
votes
0answers
15 views

Can I use Euler approximation for backwards computation?

I want to solve the following Ricatti Equation: in Matlab. I'm given the final value of P and as far as I understand I have to go backwards solving this. My question is, can I use the Euler ...
0
votes
0answers
38 views

Lagrange function on MATLAB

I'm trying to write the Lagrange function in Matlab and I need some help. This is what a friend and I have got so far, I am just not getting how to finish: ...
0
votes
0answers
21 views

randomly generate M pairs of complex numbers from 1 to N, find gcd.

I want to write a script to generate statistics on gcd's and number of steps required to find them by the Euclidean algorithm, using M randomly generated pairs $a+bi$ between 1 and N. And plot them. ...
0
votes
1answer
34 views

Solving equation in Matlab [closed]

I want to solve this equation for several values of y y=4 exp(0,034x) y= [60 14 63 34 21 12 11]; Thanks
1
vote
0answers
9 views

2D Fourier Differentiation in Matlab

I am working in Matlab to compute partial derivatives and a Laplacian using Fourier Transforms. I prefer to take spectral derivatives, since it corresponds to multiplication by a wave number, however, ...
0
votes
0answers
16 views

Find 2 point getting far away each other from their intersection point

I want to know how to find 2 aircraft getting far away from their intersection point, from Dataset such as aircraft 6-7,11-2, 10-6,37-36,etc. Dataset: my algorithm is: calculate direction ...
1
vote
1answer
26 views

How can I analyse signal with discrete wavelet transform?

With CWT it's clear enough. We have function of two variables which are scale and translation. But what about DWT? Here is Matlab code: ...
0
votes
0answers
15 views

Predict monthly event with pattern that repeats every year

General question: We look at "cost for maintenance" every month and it turns out that this is seasonal, e.g. in the summer this cost is significantly lower which can of course be explained due to the ...
-1
votes
1answer
19 views

Max value of a function in MATLAB

I am looking to find the max value of this function: log(x^(sqrt(2))) - x^3 + 4 I am having trouble with how to go about this problem. Any help is great. What I have right now is: y =@(x) log(x).^(...
0
votes
1answer
29 views

MATLAB solve a single equation

I am trying to solve this equation: $e^x=x^e+e$ in MATLAB, but I continually get an error. I do not know where to go from here. Any help is appreciated This is what I have: a = x^exp(1) + exp(1) == ...
0
votes
0answers
5 views

Simulating AR(2) models with specific distributions

Say I want to create and simulate the $AR(2)$ model $X_t =1.5X_{t-1} - 0.5X_{t-2} + Z_t$, $Z_t∼WN(0,200)$ in matlab. To the best of my knowledge I define $model = arima('ARLags',1:2,'Constant',0)$ ...
2
votes
2answers
88 views

In MATLAB, $\pi$ value is given as 355/113. why?

$\pi$ is an irrational number. MATLAB shows it equal to 355/113 in fractional format. Is there no better fractional representation than 355/113 within the limits of the finite precision the ...
0
votes
1answer
26 views

implementing double $\sum_{m=1}^{p}\sum_{n=1}^{\infty }$ sum in MATLAB

I want to calculated following double sum: $$\sum_{m=1}^{p}\sum_{n=1}^{\infty }(-1)^{n-1}\Delta H.{erfc\frac{2(n-1)u+u\gamma}{2\gamma \sqrt{p-m}}+erfc\frac{2nu-u\gamma}{2\gamma \sqrt{p-m}} }$$ I have ...
0
votes
2answers
22 views

Comparision of Axis-angle and Euler-Angles contradicting?

I used SpinCalcVis to compare axis-angle against the euler-angles and think the angle signs of both are contradicting. I used q = -1 0 0 0 as input. Using the euler-...
1
vote
0answers
14 views

How to build a matrix in MATLAB with the next characteristics?

Let $\lambda_1=\frac{k D_u}{2h^2}$ a constant value. How to generate a matrix in MATLAB with the next entries: $A= \begin{pmatrix} 1+\lambda_1 & -\lambda_1 & 0 & 0 & \cdots & 0 &...
0
votes
0answers
25 views

Problem with code for numerical integration in matlab.

Hi I have problem with calculating this expected utility with means of numerical integration, using matlab. The matrix stock data is a 1000x8 matrix with columns representing 7 stocks (columns 2-8, ...
0
votes
0answers
95 views

Rotating one 3d-vector to another only by using rotations about the coordinate axes.

If I have a vector v=(x,y,z) and would like to transform another vector u by using only rotations about the coordinate axes to be in the direction of v, how can I find required angles and the order of ...
0
votes
0answers
18 views

Matlab code - Lagrange Basis

The newxt code compute the interpolation polynomial by Lagrange's method evaluated in some vector $c$: ...
1
vote
0answers
7 views

Taking integration of a forward problem in a region of interest which is disretized-Microwave Imaging

I am trying to implemented the below formula in order to find the integration in matlab. However, I do not know how to do change of variables. The formula is $E=\int_{\Omega}H_{0}^{1}(k\sqrt|r_{s}-r'...
0
votes
0answers
12 views

upsampling and plotting a signal in matlab

I want to upsample by 5 a signal in frequency domain, and then plot(stem) it. I figured how to upsample, Fk=(1/5)*upsample(ak_new,5) now this creates a vector ...
0
votes
0answers
31 views

Projectile with air drag using MATLAB

Unsure where to ask this question because it involves coding and mathematics. I am currently using the code ...
0
votes
1answer
44 views

definite integral in matlab?

I have just started learning how to solve definite integrals in matlab, and from the documentation, I picked up this example: $\int^{\infty}_{0}(e^{-x^2} )dx$ but when I run it in my matlab, I get ...