Answered
Polinomial approximation of surface
You can try using matlab's 'svd' function. It will find a set of coefficients A11, A22, A33, ...,A0 for which the sum of the sq...

13 years ago | 1

| accepted

Answered
How to repeat rows of matrix?
Here's yet another possibility: p = accumarray(cumsum([1;v]),1); M = M(cumsum(p(1:end-1)),:);

13 years ago | 1

Answered
Keep only elements that appear multiple times
Actually I didn't need to find the inverse of permutation p. The following is one step shorter: [B,p] = sort(A(:)); t = [...

13 years ago | 0

| accepted

Answered
How do I solve this set of equations? - an overdetermined non-linear system -
You should probably seek the set of unknowns that yields the least sum of squares of your expressions on the left sides of the e...

13 years ago | 0

Answered
Keep only elements that appear multiple times
This version uses the 'sort' function instead of 'unique' and 'histc'. Consequently it might be faster. [B,p] = sort(A(:));...

13 years ago | 1

Answered
Keep only elements that appear multiple times
Here's a modification of Azzi's code that avoids the 'ismember' call. [B,~,p] = unique(A(:)); t = histc(A(:),B)<3; A(t(p...

13 years ago | 1

Answered
Find unique numbers in a set
If I were writing a 'unique' function, the first operation would be to sort the set. There are many efficient routines to do th...

13 years ago | 0

| accepted

Answered
CVX - mtimes error - multiplication of vectors
If A is a column vector and B a row vector, you should get no error message on the operation C = A*B The result should be...

13 years ago | 0

Answered
generating zeros and ones with equal probability
The difference is miniscule. It is the probability that the 'rand' function will happen to generate an exact 1/2. I would judg...

13 years ago | 0

Answered
How to assemble coefficient matrix?
I'll assume you have a0, c, and theta as column vectors of corresponding elements and of length N. IC = bsxfun(@plus,4*b./(a...

13 years ago | 0

| accepted

Answered
Singular matrix error when code is running?
In your expression for A(i,j) you divide by sin(theta0(i)) which is zero at three places as you have defined it. That will give...

13 years ago | 0

| accepted

Answered
How to add a matrix A to another matrix B with a different size and it should maintain rows of B which do not have the first two elements equal to the first two elements of a row in matrix A?
[tf,loc] = ismember(B(:,1:2),A(:,1:2),'rows'); t = loc(tf); C = B; C(t,:) = A(t,:); Note that if B contains more than ...

13 years ago | 0

Answered
Picking values from n-d array along 3rd dimension
C = A((1:m*n)'+m*n*(B(:)-1)); C = reshape(C,m,n);

13 years ago | 1

Answered
Replacing n-d array elements based on pre-defined list
If it isn't assumed that vector 'l' contains successive integers starting with 1, then you could do this: [tf,loc] = ismembe...

13 years ago | 0

Answered
MATLAB Code for Solving Critical Equation
Those equations are very unlikely to have a solution. You have three equations with only two unknowns to vary. Imagine you hav...

13 years ago | 0

Answered
How to find curvature as a function of temperature
You can find an approximate curvature from discrete data using the curvature of a circle which passes through three adjacent poi...

13 years ago | 0

| accepted

Answered
how to find mode without built-in mode function?
If you are not allowed to use the 'mode' function, it sounds as though you must use only more primitive functions. Are you allo...

13 years ago | 1

Answered
how to make an infinite sum
I'll expand on dpb's good advice. With regard to the factor contained in the terms you are adding which I will call F(n) F(...

13 years ago | 0

| accepted

Answered
Associated legendre polynomials matlab
Quote from Mathworks' documentation: "P = legendre(n,X) computes the associated Legendre functions of degree n and order m = 0,1...

13 years ago | 0

Answered
random numbers with mean-correction
In preference to the method in fileexchange/9700, (even though I wrote it,) I would suggest a method that exhibits a normal dist...

13 years ago | 0

Answered
Solving two variables in a matrix problem (A + xBe^y) = C
Starting with n-by-n arrays A, B, and C this uses the technique I previously described to find the x and y parameters creating t...

13 years ago | 1

Answered
Solving two variables in a matrix problem (A + xBe^y) = C
You are trying to equate these two quantities: a(i,j)^2 + 2*a(i,j)*b(i,j)*x*cos(y)+b(i,j)^2*x^2 and c(i,j) for all...

13 years ago | 0

Answered
Identify the mode in each column and eliminate them
Let 'a' be an array in which one element of each row is repeated the same number of times for all rows with no other element in ...

13 years ago | 0

Answered
I want use Simpson numerical integration method
The 'int' function probably could not find an explicit formula for the integral of Q in terms of general k, Ef, and T variables....

13 years ago | 0

Answered
Solving a non linear ODE with Matlab ode functions
Try using 'ode15i' which can use implicit differential equations. In your example you would presumably have the two components ...

13 years ago | 0

| accepted

Answered
Help in averaging climate data
I'll suppose you have the climate data in column five of an array, A, with the year, month, day, and hour in its columns 1, 2, 3...

13 years ago | 0

Answered
how can i find a special row
I am guessing that you mean, how can you find those rows each of which includes at least one -1. Is that what you mean? If so,...

13 years ago | 0

Answered
Sortrows(A, [2 1[) is doing the 2nd round of sorting incorrectly.
I see that your coordinates are listed using decimal fraction displays. I suggest a possible explanation for your apparent diff...

13 years ago | 1

| accepted

Answered
vision system++convert position value to motor angle
The robot "arm" can be considered as composed of four segments connecting five points. Point A is at the base of the central piv...

13 years ago | 1

| accepted

Answered
Solving system of 2nd order coupled differential equation
Apply the inverse of M to your equations to get two new equations: N = inv(M); N*M*X" = eye(2)*X" = -N*B*X'-N*C*X+N*(F*cos...

13 years ago | 0

Load more