Answered
Norminv in Matlab 2012
You can use matlab's 'erfinv' function to calculate the equivalent of 'norminv' according to the formula: norminv(p) = sqrt(...

13 years ago | 1

| accepted

Answered
Repeating fractional binary to decimal.
It isn't clear to me whether you mean a binary number with a pattern that is repeated some finite number of times, or one that i...

13 years ago | 1

| accepted

Answered
can someone help me loop this??
Rather than sweating out a vectorization, it's a lot easier to do it with a single for-loop. Also it may be just as fast or fas...

13 years ago | 0

| accepted

Answered
Replace elements of a vector with different probability for 0 to 1, and 1 to 0
You don't need a for-loop. It's a problem in logic. pdatodo=1/3; pdotoda=1/4; r = rand(size(Sent)); Received = (Sent&...

13 years ago | 0

Answered
how to solve for non linear system of equations containing series terms.
Based on the same principle as in my other answer you can compute the sum of those series using 'sum' and 'cumprod' in a manner ...

13 years ago | 0

Answered
how to solve for non linear system of equations containing series terms.
Nikhil, your method of evaluating the two infinite series will not work for the sizes of the values in 'n'. Factorial(2e4) is a...

13 years ago | 0

| accepted

Answered
How do I generate the random number inside the annulus
% Set your seed here if desired n = 50; r1 = 5; r2 = 5.12; r = sqrt(r1^2+(r2^2-r1^2)*rand(1,n)); % Using square root here...

13 years ago | 3

| accepted

Answered
All possible combinations of n pairs of 2 elements from 2 vectors of n elements without repetition of the elements
p = perms(y); [m,n] = size(p); z = zeros(m,2*n); z(:,1:2:end-1) = repmat(x,m,1); z(:,2:2:end) = p; This assumes the ...

13 years ago | 0

| accepted

Answered
Find all largest empty circles in a list of points
I am not sure what you mean by "largest empty circles". Empty of what? However, if the actual question you are asking is how t...

13 years ago | 1

| accepted

Answered
Novice question - XY vector of coordinates
'CircleFitByTaubin' expects an n x 2 array for its input, whereas you have a 2 x n array. You need to do a transpose on your in...

13 years ago | 0

Answered
Vectors of different length when using plot3.
Change the line plot3(x,y,z) to plot3(x,y,repmat(z,1,size(t,2))) hold on

13 years ago | 0

Answered
Floating numbers generation in a range
What kind of probability distribution do you wish these numbers to have over this interval? If it is to be uniform use 'rand' w...

13 years ago | 0

Answered
How to calculate distance between 2 complex points?
The reference to "phase" in your diagram would seem to imply that the 'Q' and 'I' quantities refer to the real and imaginary par...

13 years ago | 0

Answered
How to get angle two curved line, which is pinned at a point?
If d is the distance between the two points on the left of your picture, then phi = 2*acos(d/2/r); for the phi that you...

13 years ago | 0

Answered
How do I create a vector combinations in pairs
Here is a more compact way of using 'nchoosek' and 'perms'. c = nchoosek(A,r)'; B = reshape(c(perms(1:r)',:),r,[])'; wh...

13 years ago | 2

Answered
How do I create a vector combinations in pairs
What you are asking for in this comment are known as the partial permutations. I don't know if matlab has such a routine but yo...

13 years ago | 2

Answered
Change the zero angle of the atan2() or similar
If you want the order to be clockwise and if (x0,y0) is the start point then do this: ang = mod(atan2(y0,x0)-atan2(y,x),2*pi...

13 years ago | 0

Answered
how to round the decimal values
If I understand what you mean by "round up" to integers, you need the 'ceil' function: ceil(3.01) --> 4

13 years ago | 1

Answered
Real Roots of a Polynomial
Use 'roots' to find the roots of polynomials. r = roots([1,7,-8,5,1]); % Get all the roots r = r(imag(r)==0); % Save only ...

13 years ago | 5

| accepted

Answered
remove values from array under min & max conditions and under given number of consecutiveness.
Call your column vector A. f = find(diff([false;A<=a&A>=b;false])~=0); g = find(f(2:2:end)-f(1:2:end-1)>=c,1); B = A(f(2...

13 years ago | 1

Answered
find & replace data in array
[~,p] = min(abs(bsxfun(@minus,A,B')),[],2); A(p) = B; There is an inherent ambiguity possible in this problem. An element ...

13 years ago | 0

| accepted

Answered
problem with a simple division
To get that far away from 50, your n cannot be equal to 0.0500. It is actually something like 0.0499997 which in "format short"...

13 years ago | 0

Answered
How can i calculate the largest interval when the elements of an array are larger than a value?
Letting A be your row array: f = find(diff([false,A>15,false])~=0); m = max(f(2:2:end)-f(1:2:end-1)); m is the length o...

13 years ago | 0

Answered
simple False Position code
I believe your error lies in the lines if q*q1<0 p0=p1; q0=q1; They ought to read if q*q1<0 p0=p; ...

13 years ago | 0

Answered
how to create a specific matrix from an array
k = 3; B = hankel(A(1:k),A(k:end)); (Corrected)

13 years ago | 0

Answered
How to write a program to take mode of vector without using built in function 'mode'?
If you are not permitted to use matlab's 'mode' function, and if your vector is a column vector called v, do this: s = sort(...

13 years ago | 0

| accepted

Answered
Problem in plot combination
Do you have the plot scaling the same for both the x and y axes? If not, that would distort the ellipse. Use axis equal

13 years ago | 0

Answered
Obtain an output in sequential multiplication using matlab
Use matlab's 'prod' function: Zt = prod(Z1);

13 years ago | 0

Load more