Answered
Rolling sphere along two lines in 3D plane
You have said " *I have two lines in xyz plane.* " This appears to state that the two lines lie in some common plane. With thi...

11 years ago | 2

Answered
Remove slices of 3D matrix
That is because after removing the first "slice", slice number 2 becomes number 1 and when you attempt to remove slice 2 it is a...

11 years ago | 3

| accepted

Answered
Align Z axis so it is always perpendicular
Set its third component to zero: f1(3) = 0; Of course that shortens the vector. If you want to preserve its vector len...

11 years ago | 2

| accepted

Answered
How to find indices of elements but keep the order unchanged?
[tf,loc] = ismember(ch_names,pickCh); [~,p] = sort(loc(tf)); idx = find(tf); idx = idx(p); (This assumes this ...

11 years ago | 4

| accepted

Answered
help for vectorization coding for multiplication and addition matrixs
Try this: Fn = cost.*W+(W>0).*FC; and W = sum(reshape(outp(:,1:n*dr,u),[],n,dr),3); (I assume u is a scalar in...

11 years ago | 0

| accepted

Answered
how to scramble positions of a matrix?
Just use the inverses of X and Y: X2 = zeros(1,4); X2(X) = 1:4; Y2 = zeros(1,4); Y2(Y) = 1:4; A2 = B(X2,Y2);

11 years ago | 3

| accepted

Answered
Guru's needed - 3-D plotting
Normally plotting of 3D surfaces is done using 'surf' but it requires a grid-type array arrangement of the parameters, which you...

11 years ago | 1

| accepted

Answered
Need help for vectorization?
In your Aug. 20 Answers #151724 article "Please help me to modify the following program" I showed how you could replace all your...

11 years ago | 1

Answered
How do i formulate the following equation function in matlab?
You are missing four multiplication symbols, one parenthesis, and three dots on each equation. The first one should be: Ax...

11 years ago | 1

Answered
Parametric Intersection point calculation of two curves
Now that you've corrected your equations, they do have a solution - in fact seven solutions. These can be derived from the root...

11 years ago | 2

| accepted

Answered
Attempted to access y(15); index must be a positive integer or logical.
If you do a high accuracy check on what you think is an i-value of 15, you will find that it is off from the exact integer 15 by...

11 years ago | 2

| accepted

Answered
How to know if my data is randomly generated?
You have asked whether your source of the ten possible digits is random. Obviously if you are getting many different results, t...

11 years ago | 2

Answered
error message: Form of equation?
If t is an array, then to use matrix multiplication "*" the number of columns in exp((-1/2)*t) needs to be the same as the numbe...

11 years ago | 2

| accepted

Answered
Number greater than the largest positive floating-point number (1.7977e+308)
In case it is of interest, here is an alternate method of computation based on Pascal triangle summations. m = 25; L =...

11 years ago | 2

Answered
Solving a large equation
You can use 'roots'. For each value of x you can compute the corresponding value of each of the four coefficients of the powers...

11 years ago | 1

Answered
Number greater than the largest positive floating-point number (1.7977e+308)
There is a much more satisfactory way to compute that expression: round(prod((L+1:L+m)./(1:m))) or round(prod((m+...

11 years ago | 3

| accepted

Answered
what called this method of generation random sample
In the code you show, Mutah, strictly speaking the y vector is not a pdf - a probability distribution function. It is a pmf - a...

11 years ago | 2

| accepted

Answered
If there is a group of n people in a room, what is the probability that two or more of them have the same birthday?
The probability, P, (in a non-leap year) is: P = 1 - prod((365:-1:365-n+1)./repmat(365,1,n));

11 years ago | 1

Answered
Looping for finding dominating points.
Mohammed Rizvi, in a forum of this nature you really ought to carefully define a concept such as "dominating points" so as to av...

11 years ago | 1

| accepted

Answered
How to check this condition? (matlab programming)
The following code assumes there are at least 20 such pairs. If not, you will have to regenerate a and b and start over again. ...

11 years ago | 2

Answered
How to covert a vector of lower triangular matrix factors back to the original matrix?
I assume we have n where the desired matrix is to be of size n x n and the vector v which must be of length n*(n+1)/2. A =...

11 years ago | 1

Answered
solving a non-linear problem
With some mental effort I was able to reduce your new set of equations to a single variable, but this variable is x7, not x4. Y...

11 years ago | 2

Answered
To calculate the angles of the Delaunay triangles
If P1, P2, and P3 are coordinates of the three vertices of a triangle, and A is its area, its angle at P1 can be calculated as: ...

11 years ago | 2

| accepted

Answered
Uniformly distributed pseudo-random numbers
To do what you ask would require the result vector to have 145, not 144, elements, unless the vector is considered circular with...

11 years ago | 1

| accepted

Answered
Need help implementing a recurrence relation
If I interpret your initialization statement correctly, you have Y(a,b,0,0) = 1 for every non-negative integers a and b. ...

11 years ago | 1

Answered
How can I index a multidimensional array with another multidimensional array containing indices into one of the dimensions of the first array?
[n1,n2,n3,n4] = size(I); I2 = repmat(size(A,1)*(0:n2*n3*n4-1),n1,1); B = reshape(A(I(:)+I2(:)),size(I));

11 years ago | 3

| accepted

Answered
MATLAB plotting question, please help
You need to put a dot on the division symbol: y=(exp(t/10).*sin(t))./(t.^2+1);

11 years ago | 2

| accepted

Answered
Solving an implicit equation involving complex numbers
If you can express each of the four coefficients of your polynomial as functions of x, I would recommend using matlab's 'roots' ...

11 years ago | 2

| accepted

Answered
Problem with while loop, index is set back
It is not clear whether at the second '1' in vector1 of your example the '1' that is put into 'u' is copied immediately from vec...

11 years ago | 3

| accepted

Answered
what does c(:).' mean? c should be a vector
This is a short way to reshape c, whether it is a vector or array, into a row vector. You are then guaranteed that obj.coef wil...

11 years ago | 2

Load more