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

3
votes
3answers
78 views

Changing [2,4] into [0,1,0,0,0,1] in Matlab

Good day, I apologize for the very vague title, I didn't really know how to formulate what I want. However, I can explain what I mean: I have a vector v1: ...
0
votes
1answer
28 views

How to get good derivatives results in matlab?

I got the set of some points, and I need to get derivatives from it. I try to use the diff() function in matlab but, well, results kinda not ok. Is there any better ...
-5
votes
1answer
60 views

Describe the Transpose of $A= \left[\matrix{0 & 0 & 1\\0 & 1 & 1\\ 1 &1 &1} \right]$

$$A= \left[\matrix{0& 0& 0& 0& 0& 0& 0& 0& 0& 1\\ 0& 0& 0& 0& 0& 0& 0& 0& 1& 1\\ 0& 0& 0& 0& 0& 0& ...
0
votes
1answer
37 views

MATLab help involving Linear Algebra.

I am trying to understand what is happening here.. A = floor(10*rand(3)); b = sum(A')'; z = ones(3,1); If I solve the system $Ax = b$, the solution is identical ...
1
vote
2answers
211 views

help on matlab code

I would like to display errors in case a user enters a number less or equal to 0.how can i put it? thanks Problem:Write a script areaMenu that will print a list consisting of “cylinder”, “circle”, ...
1
vote
0answers
149 views

Using Lambertw to solve $x\ln(x) = a$

I am trying to solve the equation $$ x \ln (x) = a, $$ where $x$ is a variable and $a$ is a given constant, using Matlab and the lambertw function. Not really sure exactly what to type into Matlab ...
0
votes
0answers
300 views

arg max with matlab or cvx

I am trying to solve the following simple problem. arg max ( w1 * ( log( x(1) ) - B( x(4), x(1) ) ) + w2 * ( log( x(2) ) - B( x(5) , x(2) )) + w3 * ( log( x(3) ) - B( x(6), x(3) )) ) s.t. x(1), ...
0
votes
0answers
29 views

Chi2 value for normally distributed data

I have a large set (around 5000 data points) of normally distributed data. I need to calculate a chi2 value for the data to see how well it is modeled by a gaussian curve. I have seen and tried using ...
2
votes
1answer
82 views

How to express MATLAB indexing in math notation?

I am currently writing a paper concerning discrete arrays. Given the following MATALB statement ...
0
votes
2answers
105 views

Can the singular values be plotted?

I have a set of 3 x 3 co-variance matrices that I need to plot. Using singular value decomposition (svd) in Matlab I managed to obtains a vector of singular values for each matrix as stated here. I ...
0
votes
1answer
1k views

Computing a double integral using MATLAB

I need to compute a double integral using MATLAB I'm not good at programming. I believe you just have to use this function called integral2 http://www.mathworks.com/help/matlab/ref/integral2.html But ...
0
votes
1answer
41 views

Implement ideal line search algorithm

I have the function $f(x)=\frac {1}{2} \mathbf x^T Q \mathbf x$. I want to use the steepest descent algorithm where $Q$ is the diagonal matrix $\begin{bmatrix}1 & 0\\0 & 20\end{bmatrix}$ and ...
0
votes
1answer
211 views

Matlab and lambertw function

I have Matlab 7.9.0 (R2009b) I want use the W lambert function. does someone know if Lambertw is only available to updated version of Matlab ? or if i need to do something before ? I am not very good ...
1
vote
1answer
64 views

How to approximate a smooth function

Now I have a target smooth function f which is infinitely differentiable over $R^d$, $f \in C^{\inf}(R^d)$. $f = \Sigma c_ig_i(x)$, where $c_i$s are unknown coefficients and $g_i(x)$ is a smooth ...
0
votes
1answer
66 views

converting a signal back and forth with trigonometric functions

I'm trying to convert a signal back and forth using trigonometric functions. In the example below: 1) start off with a cos signal 2) convert the signal to a secant signal 3) would like to convert ...
1
vote
2answers
395 views

Unexpected Lower Triangular Matrix given by Matlab

I was trying to find the lower triangular matrix L and upper triangular matrix U of an A matrix using the [L, U]= lu(A) command. For some reason, ...
0
votes
1answer
61 views

If normal distribution can be adapted to the set of data?

Using Matlab I need to generate a sample x of random numbers (n=30) from the normal distribution, using the command normrnd, and ...
2
votes
2answers
527 views

Finding D matrix in LDU in matlab

I have been searching the web for nearly 3 hours about a MatLab function that can take matrix A and give me back L, D, and U. ...
0
votes
1answer
85 views

MatLab updating a recursive variable.

See the code x(1) = 0; k = 1; while x(k) <=6 x(k) = x(k) +2 k = k +1; end So I want the code to output x(1) = 2 x(2) = 4 x(3) = 6 ...
0
votes
1answer
119 views

Interest Rate Tree in Matlab

I would like to calibrate a interest rate tree using the optimization tool in matlab. Need some guidance on doing it. The interest rate tree looks like this: How it works: 3.73% = 2.5%*exp(2*0.2) ...
1
vote
2answers
116 views

Graphing a function f(x,y) on a restricted set of values for (x,y)

I'm having a hard time with this certain problem. Suppose that $S=\{(x,y): x^2 + y^2\leq 4\}$ and define $f:S\rightarrow\mathbb{R}$ as $f(x,y)=-x-2y-2y^2+cos(x\pi /4)$. How can we produce a (3d) ...
1
vote
0answers
78 views

Trace minimization problem in MATLAB

objective function: $\min_{X} F(X)$ constraint : $\operatorname{trace}(CXDX^H)\ge\alpha$ where A&C&Dis a matrix of $N\times N$ and X is matrix of $N\times N$ and F(X)=trace$(AX^HX)$ how ...
1
vote
0answers
112 views

Intrinsic camera parameter from three vanishing points

I would like to recover the intrinsic parameter from three vanishing points of a digital image. I read a bit on the famous textbook Multiple View Geometry in Computer Vision (pag. 226) but I couldn't ...
0
votes
2answers
2k views

How to solve Ax=0.. with 4 unknowns and 4 linear equations

I am trying to solve 4 linear equations for a 3D triangulation problem to create a function in matlab code. I have 4 equations such as aX + bY + cZ + dW = 0 eX + fY + gZ + hW = 0 iX + jY + kZ + lW ...
0
votes
2answers
62 views

How to create an image from this function?

this is a newbie question. I would like to create an image that intensity obey to the following function g() : $$ g(x,y) = \begin{cases} -10, & x \in [-50, ...
0
votes
0answers
44 views

Best optimizer in Matlab for this problem?

I need to do yield curve extraction for fixed income. I have 10 fixed income instruments for which I have values. The method is called Nelson-Siegel Method: ...
1
vote
1answer
43 views

How to know all errors in Optimization process?

I am using fminsearch in MATLAB to iteratively find the answer of a function. But it seems like the fminsearch cannot fulfill my expectation. So I ask this question whether there is any way to do what ...
1
vote
0answers
67 views

How to minimise an objective function which is not a direct function of the decision variable?

I have a problem with partitioning a water network by closing some pipes. I use some graph theory techniques to find some candidate pipes to close; but to select which pipes among them to close (my ...
0
votes
1answer
38 views

Matlab, “tranpose(x)” not doing it right?

I just found this really weird thing in matlab, when I do x = [1 2 3]; tranpose(x)*x I don't get $14$ as an output, but I get a 3 x 3 matrix ...
0
votes
1answer
144 views

System of non-linear equations

I am trying to solve a system of non-linear equations where number of valid solutions are unbounded. I am interested in only one valid result. ...
1
vote
2answers
67 views

Reducing a two term signal to one term

I am trying to solve a phasor addition problem, reducing from its original form to $$X(t) = A \cos(\omega_0 * t + \phi)$$ The original equation is : $$X(t) = 2 \sin(\omega_0 * t + 45) + ...
1
vote
0answers
103 views

Calculate a 5x5 Vandermonde system for a 5 point mesh

This is problem 1.2 in Randall J Leveque's textbook, "Finite Di fference Methods for Ordinary and Partial Di fferential Equations". I'm struggling with how to actually do the computation, I'm not so ...
0
votes
1answer
1k views

Trapezoidal integration in matlab - code explanation

I have a simple matlab script for calculating an Integral using trapezoidal rule. The idea is calculate Fourier series, and it used for the Fourier coefficients. ...
1
vote
1answer
537 views

Converting the diffusion equation PDEs to ODEs for use in Matlab ODE solvers

I am trying to convert the diffusion equation to ODEs so that it can be programmed using Matlab's ODE solvers. The diffusion equation I'm using is: $$ {\partial u \over \partial t} = D\,{\partial^{2}u ...
1
vote
2answers
1k views

Generating a triangular matrix on MatLab with loops

I am trying to create a triangular matrix from a row vector using loops. I know there are built-in commands that makes this easy, but I am a beginner programmer and I want to test this out. Here is ...
1
vote
1answer
384 views

What's wrong in my Taylor series implementation in MATLAB?

I'm trying to code Taylor summation for a function in Matlab, I actually evaluate McLaurin making $x_0=0$, named a in this code after this notation: This is the code I've tried out so far: ...
0
votes
1answer
76 views

Dense symmetric positive definite matrix

How could one define a dense symmetric positive definite matrix (dimension $1000 \times 1000$) with uniformly distributed eigenvalues (with the smallest eigenvalue $1$ and the condition number $100$) ...
1
vote
2answers
332 views

Parametric equations and specifications of a triskelion (triple spiral)

I haven't been able to find the parametric equations and specifications to form a triskelion, a triple spiral (this is made of three interlocked couples of spirals). Using the parametric equation of ...
2
votes
3answers
2k views

draw an Ellipsoid given its quaderatic equation in Matlab

How can I draw an ellipsoid in Matlab with following equation: $aX^2 + bY^2 + cZ^2 + d XY+e XZ +f YZ +gX +hY+iZ=R^2$ with (for example) $a=1; b=2; c=3; d=4; e=5; f=6; g=7; h=8; i=9; R^2=10.$
0
votes
1answer
133 views

Plot of recurring system in MATLAB, Lozi map

I need to write this recurring system in MATLAB $$ x_{n+1}=1-a|x_n|+y_n$$ $$ y_{n+1}=bx_n $$ and take its plot for every $x_i,y_i$,with let's say a=1.4 and b=0.7. $$$$This is the Lozi map. And this ...
0
votes
1answer
51 views

Basic doubt matlab [closed]

Hi I want to evaluate a function in Matlab at some points, as an example: $for$ $i=-6\pi:\pi/10:6\pi$ $fun(j)=sin(i);$ Where I want to preallocate $fun$ like ...
0
votes
0answers
31 views

Numerical problem with set of ODEs

I have a set of ODEs: $$\dot{x}_{i} = f_i(x_1, \ldots, x_N), ~ i \in \{1, 2, \ldots, N\}$$ This set of ODE has the following properties: $\displaystyle\sum_{i=1}^N f_i = 0 ~ \forall x_1, \ldots, ...
0
votes
1answer
593 views

Standard deviation for Gaussian distribution in Matlab

I have a number of test data (400 samples) that are distributed according to the Gaussian distribution, N(0,sigma). Is there a simple way of calculating the sample standard deviation sigma for these ...
1
vote
0answers
292 views

How can I write a code for the continued fraction expansion of arctan in matlab using wallis' algorithm?

I have already written the following program using wallis' algorithm for continued fraction expansion, but when I compare it to the actual value of arctan the error is high. I thought that there was ...
0
votes
1answer
58 views

Discrete fourier transform problem

We have taken $1000$ observations from signal $s(t),t \in\Bbb{R}$ $$h(k)=s(k\Delta t+t_0),k=0,1,\dots,999,$$ where $\Delta t=1/200 $ and $t_0=-2$ (in seconds). When we calculate discrete fourier ...
0
votes
1answer
78 views

MATLAB: Approximate tomorrow's temperature with 2nd, 3rd and 4th polynomial using the Least Squares method.

The following is Exercise 3 of a Numerical Analysis task I have to do as part of my university course on the subject. Find an approximation of tomorrow's temperature based on the last 23 values ...
2
votes
0answers
63 views

Compute eigenvector using given eigenvalue

I have a fairly small matrix (cca 100x100). I have computed first four largest eigenvalues (with modified Lanczsos and Lanczsos with reorthogonalization). I know this might be a rather dumb question, ...
0
votes
1answer
86 views

Fast Ax = b solver

I have got problem finding x with this equation $Ax = b$ where my matrix $A=\mu.\Phi^T\Phi+\lambda.I$ where $\Phi$ is $m$ x $n$ Gaussian random matrix. $x,b$ is vector $n$ x $1$ where I already ...
0
votes
1answer
59 views
0
votes
1answer
218 views

How to find coordinates of point in 3D given few points

How to find coordinates of point in 3D given coordinates of few(more than 3 non linear/noncoplaner) points and distance from desired point using MATLAB? suppose given five points are: [2.6643 ...