Answered
Bug in matlab R2012b version
The reality, Scarzo, is that because matlab's 'double' uses a binary number representation, it can never represent any of the fr...

12 years ago | 2

Answered
MATLAB SUMMATION HELP Please????
I notice on your other thread at Answers #142842 you have written: n = 0:201 x = [-50:0.5:50] xs = sum((x.^n./facto...

12 years ago | 1

Answered
Why doesnt e1 converges to zero
Eigenvectors are not uniquely determined even if normalized. For real-valued vectors they may be either of two opposite directi...

12 years ago | 1

Answered
Is there any way that I can optimise this code. It takes lot of time to run and for larger iteration like 'nc=10e6' its stops stating runtime error.
The use of 'symsum' repeatedly in your while-loop could be slowing you down. After all, what you have there is a geometric seri...

12 years ago | 1

| accepted

Answered
Optimization problem: solve for the size of negative price shock within a stochastic simulation
It is not necessary to run a simulation to solve this problem. Because the mean value of 'randn' is zero, after each month the ...

12 years ago | 1

| accepted

Answered
Calculaing the table of values for function defined as an infinie series
Also you can use this: E = sum(bsxfun(@power,1:10,(0:50)'),1);

12 years ago | 3

Answered
Find points on an ellipse in the xy-plane given the quadratic equation using symbolic variables.
Diederik, it is not clear what you mean by "find points on an ellipse", since there are infinitely many such points. Presumably...

12 years ago | 2

| accepted

Answered
how to plot 3D curves with for loop
In the 'for' command you write: for v=0:1:20 which means that on each trip through the loop 'v' will be a scalar quantit...

12 years ago | 1

| accepted

Answered
How can I convert a negative definite matrix into positive definite matrix?
The modified Newton's method attempts to find points where the gradient of a function is zero. If the Hessian at such a point i...

12 years ago | 3

| accepted

Answered
Substitution in Matlab (Iteration Process)
Since your four equations are to be iterative, we can also write a shifted version of the second equation which we can consider ...

12 years ago | 1

| accepted

Answered
Vector components along another one
In the line par(i,j) = norm(costh*line); it should be par(i,j) = costh*norm(line); to allow the inward and out...

12 years ago | 0

| accepted

Answered
matrix or array composed by zero-values
If M is the matrix or array, do: all(M(:)==0)

12 years ago | 1

| accepted

Answered
If else if statement problem
There is more than one thing amiss in this piece of code. Probably the problem you have in mind is caused by your 'if' statemen...

12 years ago | 1

Answered
If a=[1 2 3], b=[10 20 30], how to create c=[10 20 20 30 30 30]?
Another way: t = accumarray(cumsum([1,a]).',1); c = b(cumsum(t(1:end-1)));

12 years ago | 2

Answered
Substitution Iteration in Matlab
Here is an alternative method of solving your problem. For the fibonacci iteration, x(i) = x(i-1) + x(i-2), we can solve the qu...

12 years ago | 1

Answered
Exploiting symmetry in multidimensional arrays
For a general m-dimensional n^m array, A, do this: [I1,I2,...,Im] = ndgrid(1:n); P = [I1(:),I2(:),...,Im(:)]; Q = sort(P...

12 years ago | 0

| accepted

Answered
Exploiting symmetry in multidimensional arrays
For a 2D array it's easy: B = tril(A,-1) A = B+B.'+diag(A);

12 years ago | 0

Answered
Evaluate elementary symmetric polynomials
Let v = [x_1,x_2,x_3,...,x_n] be a vector of the values of x_i. e = sum(prod(nchoosek(v,k),2));

12 years ago | 3

| accepted

Answered
How do I avoid Infinite loop?
Your use of the while loop is inappropriate for the problem you are dealing with. You stated, "The 'AxIF' is to be updated with...

12 years ago | 0

Answered
calculate mean af cell
If your "cell" is an ordinary 'double' 30 x 39 array, A, do this: B = [mean(A(1:10,:),1);mean(A(11:20,:),1);mean(A(21:30,:)...

12 years ago | 1

Answered
Code of Iterative method's test
It looks as though you might be testing to see if the square matrix, R, fails to be "diagonally dominant". If so, here is a met...

12 years ago | 1

Answered
How to apply OR operation to a matrix?
Your example is not the 'OR', it is the 'AND', of the columns. The 'OR' of the columns is done this way: b = any(a,1); T...

12 years ago | 2

| accepted

Answered
How to find the (x,y) coordinate of an intersection value
If you don't need the intersections of the circles, there is an easier way to find the intersection of the chords. Call the cen...

12 years ago | 1

| accepted

Answered
Classification of a matrix to 0 and 1 matrix
Assuming A and B are numerical arrays arranged as shown in your diagram, B = accumarray([2*A(:,2)+A(:,3)-2,A(:,1)],1,[2*ma...

12 years ago | 1

| accepted

Answered
how to sort a matrix based on a specific value and bring the row at the beginning of the file
If you put that data in a single matrix M, the 'sortrows' function will do what you want: M = sortrows(M,3);

12 years ago | 2

Answered
Are there speedier alternatives to the mode function?
You could attempt to take advantage of the fact that elements in 'poss' are positive integers and can be used as indices. Howev...

12 years ago | 3

| accepted

Answered
How do I solve "too many input arguments" error ?
It is easy to express this solution in terms of a quartic equation in sin(delta) which could give you as many as four possible s...

12 years ago | 1

Answered
Matrix padding with logical index
In case it is of interest to you, the following code does not depend on placing NaNs in the first array. It uses the 1's in the...

12 years ago | 2

Answered
How to do Subtraction on sets?
You might consult these sites: http://www.mathworks.com/matlabcentral/fileexchange/31753-range-intersection http://www.m...

12 years ago | 1

Answered
Help Plot Complex Equation
One possibility is to superimpose two plots using matlab's 'plot' function. One of these would be the real part of f along the ...

12 years ago | 1

Load more