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
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
23 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
79 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
11 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 ...
0
votes
0answers
17 views

plot piecewise function in matlab [migrated]

This is my code: ...
0
votes
0answers
11 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
27 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
38 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
23 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
21 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
16 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
32 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.? ...
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
19 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
113 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
58 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
28 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
23 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
31 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
26 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
19 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
22 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
24 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
31 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
vote
0answers
18 views

Matlab code for generating rank deficient random matrix of order $m\times n$

I am trying to make matlab code for generating rank deficient random matrix of order $m\times n$, $m > n$. Rank deficient matrix: Here $m\times n$, $m > n$ matrix $A$ would be rank deficient if ...
1
vote
0answers
12 views

Blow-up from PDE or aliasing error? How to know and check?

I have this PDE: $u_{t}= u_{xx}+g(t)\cdot u_{x}^{2}$ (with periodic boundary conditions in the interval $(-\pi,\pi)$) that I don't have an exact solution for or know if it blows up. However, by ...
0
votes
0answers
6 views

Testing an SR1 update for approximate Hessian

I have written a function in MATLAB to run an SR1 update for an iteration of a Trust Region method to find a new approximate Hessian and its inverse, but I need to test it to check it works. Are ...
0
votes
0answers
7 views

data enterpolation with fourier

I was recently started studying fourier in remote sensing area. In matlab a fast fourier translation can be done by fft function. Here it is explained with an example. In the example of astroid path ...
3
votes
3answers
93 views

Solving Viscous Burgers using spectral method

I am trying to solve the Viscous Burgers equation using the spectral method. $$u_t+uu_x = Du_{xx}$$ where $D$ is a constant (chosen to be zero) and with the initial condition $$u(x,0) = ...
-1
votes
1answer
26 views

How to plot figure on specific time on Matlab [closed]

I am trying to plot the temperature over time($t=30$) but I want to exclude the transient initial which start from $0$ to $3$. I code in Matlab like this ...
0
votes
2answers
15 views

do math operation on two arrays of different sizes

so I'm trying to find the minimum distance between each point in a large array with that of a smaller array. The following works for a single point. ...
0
votes
0answers
20 views

Applying rotation matrix on inclined plane

I want to rotate an inclined plane to a flat surface. I think I can use the Euler angles to perform this operation. Using following points (Matlab): ...
0
votes
0answers
29 views

Matlab code for autocorrelation function for stock logreturn data.

I have one vector of T logreturn times and h lags between them. I want to estimate the autocorrelation by the function attached as well as plot the obtained values argsints the lags. How do I do this ...
0
votes
2answers
34 views

How can I effectively solve linear system $Ax = b$ with some known variables

Consider system $Ax = b, x = (x_1,\ldots, x_n)^T$. Suppose that some of variable $x_i$ is known. How can I find the rest of unknown variable effectively? Assume that system has unique solutions ...
0
votes
0answers
24 views

Optimized Distance Calculation for Data Cube

I have a cube, $C$, with dimensions $n \times m \times l$. Is there a non-iterative way for calculating a distance matrix, $D_{l \times l}$, where $D_{a,b} = \|C_{a}-C_{b}\| = ...
0
votes
0answers
14 views

Solving Linear Program involving Matrix Variables

I am using Matlab to solve a Linear program which involves 3 dimensional matrices with entries X(a,b,c). Each Linear inequality/equalities involves multiple pages of the matrix X. I can always ...
2
votes
0answers
40 views

Isotonic regression like

I have 2 ordered sets $$X=\{X_1<\dots<X_n\}$$ and $$Y=\{Y_1<\dots<Y_m\}$$ with $X_1<Y_1$ and and $X_n<Y_m$. I wish to approximate an increasing continuous function $g$ by piecewise ...
1
vote
2answers
22 views

Find null space basis matlab

I want to find the basis of null space in matlab. I know that I can find it by simply running ns = null(A,'R') or Z = null(A) ...
0
votes
0answers
11 views

Why this pulse Fourier Series MATLAB code is wrong?

I try to create a MATLAB script that plots a Fourier Series of a pulse of width d and period T. ...
0
votes
0answers
14 views

Scaling vector-valued objective function for non-linear optimization/minimization

I am trying to minimize a non-linear vector-valued function in MATLAB. As a test case for my code, I try to minimize a function whose solution I know apriori. The problem is that one of the solutions ...
1
vote
1answer
38 views

MATLAB “back slash” computation [closed]

I am looking at a MATLAB code that times the backslash operator for several cases. I will list the cases below: Note: all of these are for m = 5000 1) Z = randn(m,m); A = Z'*Z; b = randn(m,1); tic; ...
2
votes
0answers
30 views

LU Decomposition vs. QR Decomposition for similar problems

Suppose I want to solve the 2D Poisson equation with Neumann boundary conditions. The solution is non-unique up to an additive constant. I have previously asked a related question here for the 1D ...
1
vote
2answers
73 views

Monte Carlo Simulation- Simulating Sum of a DICE. Matlab CODE.

Hello everyone, I try to solve the following problem: Use Monte Carlo simulation to approximate the sum of the 100 consecutive rolls of a fair die. My work in math lab is: ...
0
votes
1answer
45 views

Define a function that is a product of two previously defined functions

New to matlab and having difficulty with the syntax since im used to using mathematica. In mathematica i can define two functions $f(x)=x$ and $g(x)=x^2$ and define a third function simply as ...
2
votes
0answers
29 views

Computing large integers with matlab.

I want to compute the collatz sequence $(n,T(n),T^2(n),\dots)$ for $$n= 100\cdot \left \lfloor {\pi \cdot 10^{35}}\right \rfloor$$ with $$T(n) = \begin{cases} \frac{3n + 1}{2} & \text{ if $n$ ...
0
votes
1answer
19 views

How do I fit the coefficients of a system of ODEs to a set of empirical data using MATLAB?

I have a system of ODEs that contains 3 unknown parameters that have to be optimised in order to fit the system to a given data set. This is the system of ODEs that I have: $\frac{dP}{dt} = -\alpha ...
0
votes
0answers
21 views

Help needed with an integration problem.

I need to compute the following \begin{equation} J(\sigma) = 1-{\int_{-\infty}^{+\infty} \frac{e^{-(\xi-\sigma^2/2)^2/2\sigma^2}}{\sqrt{2\pi}\sigma}\log [1+e^\xi]d\xi} \tag{*} \end{equation} where ...