1
vote
1answer
20 views

Matlab create matrix without loops

I'm trying to create a Matrix in Matlab, which is dependent on 2 control variables $i$ and $n$. They are defined like this: $i=1:10$, $n=0:N-1$. Now I'm trying to define a matrix, where an entry is: ...
1
vote
0answers
42 views

Secant method in Matlab

I have done following, but I don't know how to put that function into this: ...
3
votes
5answers
60 views

Round a set to the nearest values in another set (2D), faster algorithm with Matlab

Given a set of numbers, like A={{1,2.5,3}, {4.2,7,10}}; and another set of numbers, like B={1,2,3,4,5}; Is there a fast ...
0
votes
1answer
25 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
0answers
62 views

Serious trouble converting algorithm to MATLAB code

I'm new to MATLAB and I'm having a really hard time converting an algorithm that I constructed, into code in MATLAB. Can anyone please help me? Here is my problem and algorithm: Romberg Integration ...
7
votes
0answers
325 views

Problem with an algorithm to $3$-colour the edges of cubic graphs

I'm currently trying to implement an algorithm to $3$-colour the edges of cubic graphs. (I want to do this with Matlab's Symbolic toolbox). After restricting to planar graphs to ensure the existence ...
0
votes
0answers
66 views

How to solve this system with conjugate gradient algorithm

CG Algorithm https://skydrive.live.com/redir?resid=E0ED7271C68BE47C!386&v=3 System of equations, the question and the example https://skydrive.live.com/redir?resid=E0ED7271C68BE47C!387&v=3 ...
0
votes
2answers
147 views

Shift interval of log-normally distributed latin hypercube samples

first of all I'm not sure if this part of StackExchange is the right one because my question is mainly on a way to implement something in MATLAB. Ok, now let me try to pack my whole question in one ...
0
votes
0answers
32 views

STINT Approximate stochastic integrals

This is a matlab code to simulate stochastic integrals: ...
0
votes
2answers
1k views

command randn(1,N) in matlab

This program is in Matlab to simulate Brownian motion Generating GBM: ...
0
votes
1answer
113 views

Is there another solution for write the algorithm by matlab?

I have an algorithm as you can see below and i wrote it with different 2 ways but it seems there are problems for both solutions.is there any alternative to write it with different way? $$X_i(k+1)= ...
0
votes
0answers
367 views

Matlab, QR with columns pivoting

Is there any sample matlab code computing QR decomposition with columns pivoting for a matrix? I do not need an internal function, I would like to know the method... Thanks for your help...
2
votes
2answers
1k views

Runge-Kutta algorithm for a given ODE system

consider the system given by: $$x'_{1}=9x_{1}+24x_{2}+5\cos t-\dfrac{1}{3}\sin t$$ $$x'_{2}=-24x_{1}-51x_{2}-9\cos t+\dfrac{1}{3}\sin t$$ with initial values $$x_{1}(0)=\dfrac{4}{3}$$ and ...
1
vote
1answer
146 views

Trying to sort the coefficients of the polynomial $(z-a)(z-b)(z-c)…(z-n)$ into a vector

So I have a factored polynomial of the form $(z-a)(z-b)(z-c)\ldots(z-n)$ for $n$ an even positive integer. Thus the coefficient of $z^k$ for $0 \le k < n$ will be the sum of all distinct $n-k$ ...
0
votes
1answer
474 views

Is there a function in MATLAB that sorts a bidimensional array?

Is there a function in MATLAB that sorts a bidimensional array? This is how I would like to sort it: The matrix: $\left(\begin{array}{c c c} 9 & 4 & 7\\ 1 & 5 & 2\\ 3 & 6 ...
1
vote
2answers
401 views

shadow simulation from buildings

is it possible to calculate shadow areas of buildings or simulate shadows of buildings in a city, using the heights of these buildings and the sun angle and azimuth? the basic light tracing concept ...