Answered
Finding Consecutive True Values in a Vector
Let the input column vector be called x. y = [x;0]; f = find(diff([0;y])~=0); p = f(2:2:end); y(p) = y(p)-p+f(1:2:end-...

12 years ago | 2

Answered
Random sample generator from given pdf
The cdf you obtained was presumably F(x) = -1/4*x^3+3/4*x^2. It is quite possible to solve for its inverse, since that involves...

12 years ago | 0

| accepted

Answered
Question about summations from excel (backwards sum)
s = sum(fliplr(A)+fliplr(B)); Note: Whatever order 'sum' would have taken with A+B will be reversed.

12 years ago | 0

Answered
Sum of first 100 integers?
Or you could emulate the mathematical genius, Karl Friedrich Gauss, who is said to have done it this way at the age of ten: ...

12 years ago | 2

Answered
What does this mean (in solving a polynomial)
When you set d = 0.1, matlab computed 1/d to be 10 which makes your expression for I be a polynomial of the tenth degree. The s...

12 years ago | 0

Answered
How to calculate a trapezoid with 4x2 input array...
In your formulas for A and P you have made overly simplistic assumptions about the trapezoid that is input. In computing A you ...

12 years ago | 0

Answered
Subscript indices must either be real positive integers or logicals.
You have used the term 'conv' two ways, first as an array and second as the convolution function. In the second usage, matlab s...

12 years ago | 2

Answered
a disc in a matrix
It would be better to use the term 'disk' or 'disc' for this. The term 'circle' generally refers to the one-dimensional curve s...

12 years ago | 0

Answered
Inverse without the determinant normalization?
As one can see from Cramer's rule, the matrix you seek can be formed from the various cofactors of the determinant of M. I see ...

12 years ago | 0

Answered
Ensure integral don't become complex
I would suggest, instead of using quadrature functions like 'quad' which set their own values for the variable x, that you use '...

12 years ago | 0

Answered
Expansion of a polynomial (Best way)
Let a be a row vector consisting of your exponents, a1, a2, ..., an. Then try this: A = cumsum([0,a])+1; a1 = a + 1; C ...

12 years ago | 3

| accepted

Answered
Error:Subscript indices must either be real positive integers or logicals.
Matlab is telling you that 't_plot' is neither an integer greater than zero nor a logical variable. Since it is interpreted as ...

12 years ago | 0

| accepted

Answered
Why is this script so slow and how can i make it faster?
M=rand(100,110,130); [z,y,x] = ndgrid(1:130,1:110,1:100); t = M<.5; z = z(t); y = y(t); x = x(t);

12 years ago | 0

Answered
Find at least 4 consecutive values less than 1 in an array
Here's another one-liner if you accept initial indices as an answer. f = find(all(hankel(M(1:4),M(4:end))<1,2));

12 years ago | 1

Answered
randfixedsum - Sum of numbers?
I notice that in your second for-loop you write e = sum(on)-21600; even though y = randfixedsum(4321,1,7200,0,7200) is se...

12 years ago | 0

| accepted

Answered
Problem with symsum using infinity as the upper limit of the variable.
Tristan, you and I know the precise values of those infinite sums: -conj(sum(1/2^n*(abs(sign(round(n) - n)) - 1), n == 1..I...

12 years ago | 0

Answered
mutual information calculation between input and output
See my answer in http://www.mathworks.com/matlabcentral/answers/113754

12 years ago | 0

Answered
How to compute DOT & CURL function together?
That looks good to me. Remember that X, Y, and Z must be monotonic and as produced by 'meshgrid' for 'curl' to work properly. ...

12 years ago | 0

Answered
mutual information calculation for binary sequence
If you mean the theoretical mutual information of the two random variables you have defined, it would of course be zero, if we m...

12 years ago | 1

Answered
How to calculate the center of mass of a polyhedron?
I assume you are in three dimensions, Joshua. The centroid of any tetrahedron is always at the point which is the average value...

12 years ago | 0

Answered
How to find whether any non-zero row vector or column vector is there in a matrix?
Do: Res = all(comp,2); instead of Res=any(comp); That will tell you which rows of A are identical to R.

12 years ago | 0

| accepted

Answered
How is (-2)^(2/3) different than ((-2)^2)^(1/3) ?
This seeming inconsistency is due to the fact that ideally each of these two expressions has three roots or values and these are...

12 years ago | 2

| accepted

Answered
Error:DOUBLE cannot convert the input expression into a double array.
The system could not find an explicit formula for the indefinite integral as a function of y. If you put definite numerical val...

12 years ago | 0

Answered
verification of an integral
Here is my guess as to the problem. In your first integral with respect to r you don't indicate that you included the Jacobian ...

12 years ago | 0

| accepted

Answered
How to compute DIV of CURL of vector ? Taking load wind as example
That the divergence of the curl of a vector field is identically zero follows easily from the famous identity in calculus that ...

12 years ago | 0

| accepted

Answered
Research question : how to compute chirality by DIV & CURL function
As far as I can see, the equation you show does not contain any divergence operations. One term is the scalar (dot) product of t...

12 years ago | 0

Answered
generating a subset of specific of unique 3 groups out of 84
Suppose [i1,i2,i3,i4,i5,i6,i7,i8,i9] is one of your combinations. Then you can reference the corresponding three values in C1 u...

12 years ago | 0

| accepted

Answered
Failure in initial user-supplied objective function evaluation. FMINCON cannot continue.
The purpose of the xo argument in fmincon(fun,xo,...) is that it, in Mathworks' words, "starts at xo and attempts to find a mini...

12 years ago | 0

| accepted

Answered
Please help with this quadratic equation
You hardly need matlab to solve that problem. Rewrite it as: z - abs(z)^2 = -j*.4 where z = x + j*y with x and y being t...

12 years ago | 0

Answered
Why do I get NAN?
Any of these arithmetic operations will produce a NaN: zero/zero, zero*infinity, infinity/infinity, infinity-infinity. For exam...

12 years ago | 5

| accepted

Load more