Answered
bin data and sum values
[counts,idx] = histc(x,bins); t = accumarray(idx,y,[size(bins,1),1]);

12 years ago | 2

| accepted

Answered
subtraction and multiplication of two arrays
A = 0.3*bsxfun(@minus,t,T'); This gives the result you have specified except for the -0.54 at (1,2). I think that may be an...

12 years ago | 0

| accepted

Answered
For intersecting circles, how to remove overlap and have chord visible? Also, how to randomly generate circle position in design space?
Let P1 = [x1;y1] and P2 = [x2;y2] be column vectors for the coordinates of the two centers of the circles and let r1 and r2 be t...

12 years ago | 1

Answered
how to make sum of (for loop)
Assuming b is a scalar, s = a + 2*sum(cos((1:n)*b)); An alternate formula without the long summation is: s = a + 2*co...

12 years ago | 1

Answered
find matching rows in matrices
Use the 2nd and 3rd returned arguments in 'intersect': [~,index_A,index_B] = intersect(A,B,'rows');

12 years ago | 7

| accepted

Answered
simple domain decomposition, while loop
There is no reason to suppose that such a procedure as you describe will converge properly to a solution. It all depends on the...

12 years ago | 2

| accepted

Answered
Find a 2x2 matrix X=(abcd) with real entries such that X^2 + 2X = -5I
Equations of the kind you have written can have a surprisingly large number of solutions. In the example you give, if a is any ...

12 years ago | 2

| accepted

Answered
Problem with x=A\B. Bottom rows of answer equals to zero.
The equations you are trying to solve with X = A\B are given by: A*X = B where from the sizes of A and B, X must be of ...

12 years ago | 2

| accepted

Answered
How can I perform matrix operation efficiently?
If m is much smaller than n and assuming Y is a column vector, try this: R = zeros(m); TX = X'; for ix = 1:m R(:,ix)...

12 years ago | 2

| accepted

Answered
Creating random points along polygon boundary?
Only after I worked out a solution did I see Kelly's/John's solution. Well, I'll give mine anyway just for the heck of it. L...

12 years ago | 2

Answered
Extracting the second decimal point of a number
A=[8.18750]; d = mod(floor(100*A),10);

12 years ago | 3

| accepted

Answered
Generate random polar angles
The requested distribution of theta is generated below. Consequently the following code will places yellow dots on the unit sph...

12 years ago | 0

| accepted

Answered
for loop indexing and skip numbers
You can also use ix = floor((4*(1:n)+2)/3); where n is the desired length of the output.

12 years ago | 2

| accepted

Answered
Finding x & y-values that maximize an expression!!!!
Revised statement: J has no maximum value. It could have local maxima points, depending on the locations of the points (xi,yi)...

12 years ago | 0

Answered
How to do this more efficiently
It isn't necessary to do the inequality test for every possible pair of kk and mm values. Since kk and mm are integers and Ts m...

12 years ago | 2

| accepted

Answered
how to store new matrix on the old one
To accomplish what you appear to have in mind you would need to modify your code to: for k=1:m, E=[]; for j=1:4, ...

12 years ago | 0

| accepted

Answered
How to select corresponding value from an array?
If I interpret your word 'close' as meaning 'closest', then you can do this: theta=[.5 1 1.5 2 3 4 6 8 10 20 30 35 40 45 50 ...

12 years ago | 2

| accepted

Answered
How can I arrange or matrix columns, depending on the total sum that has the columns?
Do s = sum(A,1); p = find(s(1:end-1)==0&s(2:end)==1); B = A(:,[setdiff(1:size(A,2),p),p]); (Corrected)

12 years ago | 0

| accepted

Answered
Can anyone help me in calculating Kelvin Kei function.
See the sites: http://en.wikipedia.org/wiki/Kelvin_functions http://www.mathworks.com/help/matlab/ref/besselk.html The ...

12 years ago | 3

| accepted

Answered
Solving system of inequalities
As they stand, your particular five conditions are equivalent to the three equations: x+y+z=1 x+y+0.5z = 0.9, x+y+1.5z...

12 years ago | 0

Answered
Create a multi value variable
To get you started here's a hint in the form of another question. In the following code what are all the possible values of the...

12 years ago | 1

Answered
How can I sum edge weight in selected vertices ?
% Define a group G = [1,3,4]; % calculate the weight between nodes C = nchoosek(G,2); W = sum(edgeMarix(sub2ind(size(...

12 years ago | 1

Answered
I need to find an inverse function of my equation. However, the output shows a RootOf in the equation. How can I get the inverse of my equation?
Finding the inverse of your function amounts to solving for x as a function of y. Unfortunately this is a quartic equation in x...

12 years ago | 1

Answered
Numerical Integration matlab Help
To compute this integration numerically you will have to do some kind of simplification in expressing the integrand and in calcu...

12 years ago | 1

Answered
How to join two vectors
Xg(R(:,1)) = R(:,2); Xg(setdiff((1:size(x1,1)+size(R,1))',R(:,1))) = x1;

12 years ago | 0

Answered
Help in numerical exercise
If you look at this site in the section called Anecdotes" you will see a short cut to obtaining your answer. It doesn't require...

12 years ago | 1

| accepted

Answered
plot is going to zero
The test you make at: if(delta_K >= delta_K_TH) is not satisfied for 'sigma_maximum' equal to 2 and 3. Consequently th...

12 years ago | 1

Answered
Trying to do a Sieve of Eratosthenes question. It's working to an extent where the numbers appear correctly but adds a number after the previous number. For exmaple: 2 then 2, 3, then 2, 3, 5 then 2,3,5,7
Because you have not ended the line ones(length(ones) + 1) = array(i) with a semicolon, it is displaying at each step the...

12 years ago | 0

Answered
Initializing matrix randomly and by sample
For the first question use 'randi' p = randi(n,1,k); U = X(:,p); For the second, very different, question do: U = r...

12 years ago | 0

Answered
Error when multiplying complex numbers
Pascal, your difficulty is almost certainly due to displaying your numbers with the 'short' format. You aren't displaying the n...

12 years ago | 2

| accepted

Load more