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
0answers
9 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
13 views

Matlab - Solve PDE (method of lines) with an ODE boundary condition depending on a different compartment

I am modelling simple onedirectional 1D diffusion in one compartment using method of lines in Matlab. However, at x=n, I'd like to impose a boundary condition that depends on the exchange of the ...
0
votes
0answers
17 views

Rotate circle about line if a point on circle is on the line

I'm working with unit-distance graphs in $\mathbb{R}^3$, so all points are in $\mathbb{R}^3$ and points $x$ and $y$ are adjacent (notation: $x \sim y$) if and only if $|x-y|=1$ (where $|x-y|$ denotes ...
0
votes
0answers
10 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
19 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
17 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
22 views

Help with Matlab code, Undefined function or variable [on hold]

% 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,b) between 1 and N gcdcount=zeros(1,1); ...
0
votes
1answer
30 views

Solving equation in Matlab [on hold]

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
5 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
14 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
17 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
13 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
17 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) ...
0
votes
1answer
28 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
82 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 ...
-1
votes
0answers
20 views

Matlab - calculate variance and expected value

I have a matlab question to solve some probability theory, expected value and variance. the code so far: ...
0
votes
1answer
23 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
1answer
12 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 ...
0
votes
0answers
15 views

How write this function in Matlab? [closed]

I got this constrained function and trying to use Matlab to solve it. $$ \frac 1 2 x^TXAXx: \lVert x \rVert^2=1,$$ where $A$ is a symmetric $n \times n$ matrix and $X$ is the diagonal matrix with ...
1
vote
0answers
12 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
20 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
64 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
9 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 ...
-1
votes
0answers
9 views

How to save a variable in a function callback as application-defined data [closed]

I am asked to write a matlab GUI program. The instruction tell me to save some variables in a function callback as application-defined data in order to use it in the other programs. What is ...
0
votes
0answers
17 views

plot piecewise function in matlab [migrated]

This is my code: ...
0
votes
0answers
10 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
21 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
37 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 ...
0
votes
0answers
14 views

Rosenbrock function matlab

I am new to MATLAB and I am asked to implement on matlab the following algorithm: for an unconstrained minimisation problem. I am asked to apply the BFGS method with armijo line search ...
1
vote
0answers
14 views

Implementation of Jacobi theta functions in Matlab

I need Jacobi theta functions for my Matlab program. The functions are not included in the predefined Matlab functions. Doing a simple Google search, I found a package developed by Moiseev I. in 2008. ...
0
votes
0answers
14 views

System of 2nd Order Non-linear ODE

I am trying to solve a system of 2 equations in Matlab. Both equations are 2nd order, nonlinear ODEs. I don't know which function(s) should I use? $$\ddot{X} = {{-M_{cp} r \ddot{\theta} \cos \theta + ...
0
votes
0answers
14 views

Fitting with initial conditions

i try to do some fits but i have ten initials conditions and i think it will be difficult to evaluate the sensitivity of my conditions. Do you know some methods which allow to know the sensitivity of ...
0
votes
1answer
31 views

I dont know what is wrong ? MATLAB error in 'int' [closed]

I am new to MATLAB. I tried to use this command but it gives an error. Can you please point out what is wrong.? ...
-1
votes
0answers
12 views

Finding x in Ax=B using Householder and Givens Rotations

So I've written code to factor A into QR using Householder and Givens, but now I need to somehow find x, given A and b using them, and I'm confused at how I could find be using these QR factorizations ...
0
votes
0answers
14 views

Matlab: How to find a permutation matrices

I'm trying to figure out a way to compute the permutation matrices R and L given two matrices A and B. I would like to get L and R given that I know A and B. B=L* A* R. I wrote the code below for ...
0
votes
1answer
18 views

Cartesian to spherical coordinate :MATLAB program

I am a beginner to MATLAB. I have written this function, but don't understand what is wrong. I have used a if statement to correct the phi. Say if i use (x,y,z) = (0,-4,3) i should get (5,270,53.13) ...
1
vote
2answers
87 views

Numerical integration in Matlab (Simpson's rule)

A cubic polynomial is given by $$y=\frac{x^3}{6RL}$$ with $R$ and $L$ being constants. Use Matlab and numerical methods to find $x_l$ so that $$L=\int^{x_l}_0 \sqrt{1+(y')^2} dx$$ when $R=200$ and ...
0
votes
1answer
51 views

Finite Difference Method MATLAB Program

I am a beginner to MATLAB. I am trying to create a MATLAB program for the finite difference which is to calculate potential in a grid. I have to include a condition such that the iterations stop once ...
0
votes
0answers
25 views

Interpolate solution derived with Matlab PDE tool

I have tried to solve a bvp problem using Matlab. Matlab succesfully returned the result of the numerical procedure based on an internal finite element method. However I don't know how to interpolate ...
0
votes
0answers
3 views

How do we accomplish the subtraction of two infinities in a PWL Approximation?

I am trying to implement a piecewise-linear function of an M/M/1 Queueing system in an ILP to approximate the delay values. I have expressed my PWL constraint as follows: $\alpha_{i}+ \beta_{i}u_{n_s} ...
0
votes
0answers
15 views

gamma distribution and inverse gaussian distribution using matlab starting from uniform rand

I have a problem that i want to draw gamma distribution and inverse gaussian distribution using Matlab starting from the uniform random distribution , i tried to this using the relation between ...
0
votes
0answers
28 views

How to represent a system of quadratic equations in matrix form

Suppose I have two quadratic equation like the following: $2x^2 - 3x + 2$ $x^2 + 5x + 6$ I want to find the minimum values of these equation with the constraint that: $-3 \lt x \lt 5$ How ...
0
votes
0answers
24 views

Drift management optimization

I have a problem in which I am having trouble formulating the optimization. A portfolio value is $10M I have a vector of current weights [.10,.15,.15,.10,.05,.10,.20,.15] and another vector of ...
0
votes
0answers
18 views

How to do importance sampling if $ f(x)=\frac{\sin x}{\ln x}$?

Let $$ f(x)=\frac{\sin x}{\ln x }$$ In importance sampling, I should choose $g(x)$ to reduce variance. My question is, what kind of function should I choose if $f(x)=\frac{\sin x}{\ln x}$ (like ...
0
votes
0answers
19 views

Spline and derivative

I have a matrix $A$ in which each column has the 3-d coordinates of some points. so $A$ is $3 \cdot n$ where n is the number of my points. spline=cscvn(A); ...
1
vote
2answers
20 views

Using linear algebra operations over a finite field in MuPad

When I try to use MuPad's linear algebra operations over a finite field, I receive the error 'An arithmetical expression is expected.' How should I go about doing this? ...
2
votes
1answer
28 views

I've found a MATLAB plot in a book and want to know which command the authors used for the plot

I'm reading a book where the authors write that is a MATLAB plot of the approximation obtained by the method of lines for the finite difference approximation of the Nagumo equation $$\frac{\partial ...
-1
votes
0answers
14 views

matlab code for finite volume method

I am trying to write a matlab code which is about applying Roe linearization to the 1D shallow water equation. In addition, I should include entropy fix. This is a function that I defined: function ...