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
2answers
220 views

3D plot problem

I have a matrix $(A_{10*10})$ in which each elements of matrix states the value of the function $y=f(x,y)$. Since, $y$ shows the enclosed area between two squares, so I don't have the value of these ...
2
votes
1answer
2k views

Evaluating a line integral of a vector field numerically

I have a vector field (velocity) and I want to integrate around a rectangle. If I had a function for the field it would be easy and I know how to do it. However, I only have the coordinates. Is there ...
0
votes
1answer
544 views

Matlab multivariate normal distribution parameters (mvnrnd)

I need to use the mvnrnd function in matlab to generate random monthly returns for a set of assets. However, I am a bit confused about how to use this function to do it since it asks me MU and SIGMA ...
0
votes
1answer
431 views

Are quadprog and portopt equivalent in Matlab?

What exactly is the difference between quadprog and portopt in Matlab? For example if I use quadprog (minimizing the variance) in a loop in which I continuously iterate through the expected returns of ...
1
vote
1answer
2k views

Matlab Trust-region-reflective algorithm warning

I am very new to matlab and trying to solve portfolio optimization problem (minimizing the variance) using quadprog: ...
0
votes
2answers
2k views

Using Matlab quadprog to solve markowitz model

I have the markowitz model shown below and I need to use the quadprog function to solve it (i.e get the values for w_i values). However I am a bit new to mat lab and not sure which definition of ...
0
votes
1answer
351 views

Price-Yield Curve with Matlab

Not sure if this is the right place to ask but I was wondering if anyone has an idea about how to draw a Price-Yield curve. Is there ready-to-use formulas for this purpose ? An example of curve and ...
2
votes
1answer
3k views

Can't understand a simple wave equation matlab code

I'm trying to figure out how to draw a wave equation progress in a 2D graph with Matlab. I found this piece of code which effectively draw a 2D wave placing a droplet in the middle of the graph (I ...
0
votes
0answers
351 views

How to find intersections of hyperbolas by MATLAB

Let's have two hyperbolas given by equations: $$\mathbf{r}^T\cdot \mathbf A_1\cdot\mathbf r+\mathbf b_1^T\cdot\mathbf r+c_1=0$$ $$\mathbf{r}^T\cdot \mathbf A_2\cdot\mathbf r+\mathbf b_2^T\cdot\mathbf ...
1
vote
1answer
311 views

Produce piecewise monotonic function with 3 points and their slope with MATLAB

I'm trying to reproduce the shape of an airfoil's camber line using the leading edge angle, the trailing edge angle, the chord and the max camber value. I cannot use a spline because it overshoots ...
1
vote
1answer
121 views

Representing non-fuzzy memberships

I'm trying to model an input for a FIS in Matlab, unlike other inputs this value is a boolean Yes / No Do I use two membership functions that do not overlap but cover the entire domain e.g NO (0 - ...
0
votes
1answer
321 views

Strange behaviour with ode45 in matlab, probably some numerical error.

I'm having a problem with a parameter estimation in a non-linear model. I think the culprit is that ode45 (an ode solver in matlab) is not properly solving my ode. It's the in red highlighted part, ...
0
votes
1answer
82 views

Is Matlab free from cancellation of digits in solving elementary equations?

Few days ago,I had a problem solving elementary equations in flash action script 3. I asked here and got an anwer ,I thank him very much. How to safely solve a pair of elementary equations in a ...
1
vote
0answers
153 views

Optimization via Simulation

I want to minimize and objective function $\hat{B_i}$ $i\in l$, which can be computed by a matlab code (assume $\operatorname{findB}(a, b, c)$ returns $B$. I have the following optimization problem: ...
1
vote
4answers
2k views

Bayesian Network for dummies

I know the Bayes Theorem but I've never heard nor used Bayesian Networks. Now I'm told to use Bayesian networks to estimate a dysfunction probability in a noisy signal with Matlab Can someone please ...
0
votes
1answer
368 views

What is the CDF for the following PDF of a cut-off log-normal distribution (in Matlab)?

This is a cross-post from stats.SE. The radii r is drawn from a cut-off log-normal distribution, which has a following probability density function: ...
0
votes
1answer
960 views

Differences behind different methods of fminunc in MATLAB?

Assume I have some .m file with a function (and it's gradient) to be used by fminunc() in MATLAB for some unconstrained optimization problem. To solve the problem ...
0
votes
1answer
183 views

How to apply the solution of $y(n) = (0.85)y(n-1) + x(n)$ to data

I learned how to solve difference equation $y(n) = (0.85)y(n-1) + x(n)$ using z Transform, and inverse z Transform, I get $h(n) = 0.85^n u(n)$ where $u(n)$ is unit step sequence. Now my ...
0
votes
1answer
4k views

Linear interpolation

The blue curve is a set of (X,Y) coordinates. Orange segment passes through two of these (X,Y) coordinates (black dots of ...
1
vote
1answer
430 views

Finding the poles of a system from a difference equation in MATLAB

I have a system tha is described by the following difference equation: $y(n) + 0.3y(n-1) - 0.3y(n-2) = 0.5x(n) - x(n-1)$ How can i compute, using MATLAB (e.g. with ...
0
votes
1answer
113 views

Linear algebra with a linear model (Matlab)

Given the equation $$r = B + e(r\cos(\theta))$$ and the corresponding data: $\theta: 0.88; 1.1; 1.42; 1.77; 2.14$ and $r: 3; 2.4; 1.65; 1.25; 1.01$ How do you input these data for matlab to ...
2
votes
1answer
580 views

Linear Algebra, Least Squares and Error (Matlab)

"Let $A$ be a $4 \times 4$ random matrix with rank $2$ (check that its rank is $2$). Let $b$ be a random vector in $\mathbb R^4$. Check that the system $Ax = b$ is inconsistent and then find a ...
5
votes
4answers
3k views

To “subtract” two matrices with different dimensions in Octave (Matlab)

I have matrix and need to subtract another matrix element by element on each row. Something like this: $$ \begin{pmatrix} x_{1} & x_{2}\\ x_{3} & x_{4}\\ \vdots & \vdots\\ x_{n-1} ...
0
votes
1answer
133 views

MATLAB function to find the argument of a discrete time complex signal

I have a MATLAB question. How can I calculate and subsequently plot the argument of $$x(n) = e^{(0.1 + 0.3j)n}$$
0
votes
1answer
475 views

Computing circumcenter of triangle in 2D with MATLAB

I'm writing a finite volume program over a 2D triangular mesh, and at one point I need to calculate the circumcenters of the triangles. The equation given in class and that on Wikipedia give different ...
4
votes
2answers
1k views

Solving $Ax=b$ under $L_1$ $|Ax-b|$ minimization

I would like to solve a linear system $Ax = b$ under the $L_1$ norm constraint $\min(|Ax-b|)$. All that I can find about $L_1$ minimization is a way to minimize $|x|_1$ subject to $Ax=b$. I wanted to ...
3
votes
1answer
946 views

MATLAB Hermite interpolation

Anyone know where I can find the Hermite interpolation algorithm in MATLAB. Which Hermite interpolation algorithm solves this? I need to calculate a polynomial. Example: ...
2
votes
2answers
1k views

What does the Matlab loglog plots do that is useful?

If there is a exponential relationship $y = e^x$ and we take the logarithm of this we can see a linear relationship $\ln (y) = x$. So we could plot the logarithm of the y-axis values against the x ...
2
votes
1answer
229 views

MLE mean and variance for Gaussian Univariate

I'm trying to learn up some matlab to do some basic computer exercises and I have a small doubt in a question, the problem first arises in my very little knowledge in the subject of pattern ...
-1
votes
2answers
760 views

write text using an equation

Well like the batman equations and equations for heart, I once saw a site that draws equation for whatever text you type....but now I can't find it. Does anybody know such a site? Also a general ...
0
votes
1answer
1k views

Matlab: how to create a function $f(x)$ and get the value of $f(x)$ given $x$?

I'm a newbie to matlab and wonder how to create a function (i.e., $f(x) = 2*x+1$ ) get the value of $f(x)$ given $x$. In the above example, say $x=2$, I'd expect the result to be $5$ (yep, trivial ...
2
votes
0answers
106 views

Linear Algebra text with Matlab

We are in the process of revising our 2 quarter sequence on Linear Algebra and ODEs. (The prerequisite is a 2 quarter sequence in differential and integral calculus. This is a service course for ...
1
vote
1answer
564 views

Different results for row reduction in Matlab

Consider the following matrix: $ \left[ \begin{array}{ccc} -0.05 & 0.45 & 0 \\ 0.05 & -0.45 & 0 \end{array} \right] $ Row reducing the above matrix in Matlab using the rref() ...
1
vote
0answers
88 views

Solving multiple phase angles for multiple equations

I have several equations and each have their own individual frequencies and amplitudes. I would like to sum the equations together and adjust the individual phases, ...
1
vote
1answer
246 views

Representation of Fourier Transform's vectors

I am just learning FFTs and I am trying to debug a problem in MATLAB. I think I don't understand how is MATLAB's FFT function handling the polynomial powers, or I am doing something wrong manually. ...
0
votes
1answer
155 views

Help needed with something like Matlab Solver or Mathematica Solver

I have never learnt to use the services (I have them though) but now I was given a massive amount of equations and I cannot really handle them without some solver tool, just plug equations and ...
1
vote
1answer
1k views

How to create a function in matlab given the y values?

I was wondering if it is possible to create a function f(x) in matlab based on y values. Example X=[0,1,2,3,4,5,6,7,8,9] Y=[5,6,7,8,9,10,11,12,13,14] In this trivial example I wish to get f(x)=x+5 ...
1
vote
1answer
277 views

How to select a sensible tolerance when making approximations in MATLAB

I'm approximating $\pi$ using a series in MATLAB. I can approximate to within a relative error of $3\times 10^{-10}$ of MATLAB's built-in value. How would I choose a sensible tolerance for my ...
1
vote
3answers
988 views

Linear Algebra Question (Polynomial Interpolation)

Given the data for an experiment: Velocity: 0, 2, 4, 6, 8, 10 Force: 0 , 2.9, 14.8, 39.6, 74.3, 119 (One force value listed below one velocity value in a table) Find an interpolating ...
1
vote
1answer
52 views

Calculating Basis Functions for DFTs (64 Samples)

I am attempting to graph some 64 sample'd basis functions in MatLab, and getting inconsistent results -- which is to say, I'm getting results that are still sinusoidal, but don't have the frequency ...
4
votes
1answer
497 views

Eigenvalues of unitary matrices

I have a sparse unitary matrix with complex entries and want to compute all its eigenvalues. Unfortunately, matlab doesn't like this. If I try do enter eigs(A, N) (A the matrix, N its size), it tells ...
0
votes
1answer
621 views

using “princomp” in matlab for clustering

I have a set of matrices which should fall into 3 distinct set/groups/clusters. They are unlabelled. I wish to do unsupervised clustering with PCA. I am using matlab as well. At the end I would also ...
4
votes
2answers
735 views

Fitting an exponential function to data

I have a noisy data set (the grey line in the graph below) that corresponds roughly to $y=m(1-2^{-x/k})$ where m and k are unknown constants. How can I determine the best-fit value of m and k? I ...
0
votes
1answer
267 views

How to plot graph y=1/x or y=x^2

I am using Octave but I think it applies to MatLab too, so I'm tagging this MatLab since there isnt a Octave tag When I do x=linspace(-5,5,25) y=1/x I get ...
0
votes
1answer
244 views

New to MATLAB, having some trouble solving systems differential equations

I need to numerically solve $$\frac{\mathrm dx}{\mathrm dt} = y - x^3$$ $$\frac{\mathrm dy}{\mathrm dt} = -x - y^3$$ with initial conditions $x_0,y_0 = 1,0$ for $t$ from $1$ to $100$. I don't know ...
1
vote
1answer
508 views

How to solve a symbolic non-linear vector equation?

I'm trying to find a solution to this symbolic non-linear vector equation: ...
1
vote
1answer
187 views

Weibull Distribution Behaving Weirdly?

I'm attempting to fit a cumulative Weibull curve to some psychophysics perception data. Basically, we're testing the subject's accuracy at a number of different motion speeds, and attempting to fit ...
4
votes
2answers
526 views

How to generate and use random trees?

I have the assignment to implement a random tree classifier in MATLAB. The lecture says: ...
0
votes
1answer
9k views

Second order differential equations using MATLAB

I'm trying to input a second order differential equation to solve into matlab over x = 0 to x =1. I can't figure out how. Here's the equation: $\displaystyle y'' = 1 + 0.1 ...
0
votes
2answers
367 views

How to evaluate the integral $\int_a^b{\int_0^{2\pi}{\sqrt{y^2(\cos^2{\theta}-1)+1}}\mathrm{d}\theta}\mathrm{d}y$

How to evaluate the following integral in Matlab? $$\int_a^b{\int_0^{2\pi}{\sqrt{y^2(\cos^2{\theta}-1)+1}}\,\mathrm{d}\theta}\,\mathrm{d}y$$ $a$ and $b$ are vectors with values.