Answered
Calculate angles between two intersecting lines using the slopes
That formula comes from the trigonometric identity tan(A-B) = (tan(A)-tan(B))/(1+tan(A)*tan(B)) Note: You have the sign...

12 years ago | 0

| accepted

Answered
Mutual array between matrixes ( complete )
Christopher is right. The function you need is 'setdiff' using the 'stable' option. n = length(x1); y1 = x1((c1+1):c2); ...

12 years ago | 0

Answered
find values for the equation of a circle
a = 2; b = 2; r = 2; A = [1 2;1 3;2 4]; B = A((A(:,1)-a).^2+(A(:,2)-b).^2==r^2,:); B contains the coordinate pairs, if a...

12 years ago | 1

| accepted

Answered
Random Sorting within a set of columns
The following code is a bit awkward and could be slow for a 1000000 x 4 matrix, but if you are taking three weeks to use it, I d...

12 years ago | 0

| accepted

Answered
error warning "Explicit solution could not be found"
If you were to multiply each equation by the respective values 'a', 'b', etc. these would be a set of homogeneous linear equatio...

12 years ago | 1

| accepted

Answered
Help vectorizing 2 For loops with meshgrid and subscripts
[Xm,Ym] = meshgrid(1:a,1:a); [X1,X2] = meshgrid(Xm(:),Xm(:)); [Y1,Y2] = meshgrid(Ym(:),Ym(:)); mat = (X1-X2).^2+(Y1-Y2).^...

12 years ago | 0

Answered
Convergence of Laguerre Function
Hamdi, Your trouble is entirely due to round-off errors whose effect becomes large for large order Laguerre polynomials, togethe...

12 years ago | 1

| accepted

Answered
Use eigendecomposition to compute number in modified Fibonacci sequence
First, you can convert the recursion to y_(k+1) = y_k + y_(k-1) where y_k = x_k - 4. Then you can write [y_(k+2);y_(...

12 years ago | 2

Answered
Integration in Matlab from negative to positive infinity
The equal sign "=" is what matlab is complaining about. Read the documentation and you will see no equal sign in the required c...

12 years ago | 1

Answered
numerical double integration symbolically and numerically
The part of what you propose, R yan, that is not certain of success is whether matlab can succeed in finding a symbolic expressi...

12 years ago | 1

Answered
Polynomial arrays intersection and area within intersection
@Rick. What Ahmet has given you _does_ in fact help. Your mistake lies in assuming powers for matlab's 'intersect' function th...

12 years ago | 3

| accepted

Answered
creating matrix by iteration 2
A = floor((15:8:47)'/10);

12 years ago | 1

Answered
How to Convert vector elements to zero for certain N length when its values gets negative?
I think I understand you now. How about this: n = length(F); for k = 1:n if F(k) < 0 F(k:min(k+N-1,n)) = 0; ...

12 years ago | 0

Answered
How to Convert vector elements to zero for certain N length when its values gets negative?
I am not sure what you mean in your remark "till N (lets N=8)". Do you mean that a maximum of N successive negative values in F...

12 years ago | 0

Answered
parameter for geting similar permutation?
The easiest way to accomplish that would be to use 'randperm' to produce a random permutation, p, of the sequence 1:length(k1) a...

12 years ago | 1

Answered
How can I count the values with the threshold value in a vector in MATLAB?
It would not be easy to perform your task with vectorized code, so here is code using a for-loop. Let v1 be the indicated row v...

12 years ago | 1

| accepted

Answered
How to perform L2 normalization?
If v is the vector do: v = v/norm(v); (The 'norm' function gives L2 norm as a default.)

12 years ago | 1

| accepted

Answered
Solving for a function, quite confounding
Though you haven't said so, I assume that R, c, k, and T are also constants. I also assume that since a_nu as you defined it do...

12 years ago | 1

Answered
I am trying to plot this function dxdt=N0*sin(omega*t)*x*(1-x/K) to get a 3-D plot but my code does not work,where is the error?
It is not necessary to call on 'ode45' to solve this particular differential equation. By ordinary methods of calculus, integra...

12 years ago | 0

| accepted

Answered
Strange graph artifact when performing diff() of a high order
For the higher derivatives you need to increase the size of h which means decrease the number of points, I. There has to be a b...

12 years ago | 1

Answered
how many number of values when added becomes equal to B(Known value)
Assume 'a' is a row vector. x = 1:size(a,2); X = x(cumsum(x.*a)>=B);

12 years ago | 1

| accepted

Answered
How to avoid rounding off errors in parametrization?
First you need to get to translate to get rid of the D*x and E*y terms which I assume you have already done, which brings you to...

12 years ago | 1

| accepted

Answered
Plotting a complex number.
I suggest you use 'plot3' with the frequency along one of the axes and the real and imaginary parts of your matrix along the oth...

12 years ago | 1

Answered
how to find different permutations of columns of a matrix such that at any permutation just two columns change place
c = nchoosek(1:n,2); p = repmat(1:n,size(c,1),1); for k = 1:size(c,1) p(k,c(k,:)) = p(k,c(k,[2,1]); end Each row of...

12 years ago | 1

Answered
how to compair two vectors element wise and exchange the biger element with the small elements of two vectors
X = sort([B;A],1); B = X(1,:); A = X(2,:);

12 years ago | 1

| accepted

Answered
How can i call the value of another variable defined or solved above for solving another equation?
Instead of using 'solve' try using 'roots' for numerical solutions. It will be much faster. Also, 'solve' will in general be...

12 years ago | 1

| accepted

Answered
What is the fastest way to list all positive integer vectors whose sum of elements equals K.
K = 20; % The required sum n = 5; % The number of elements in the rows c = nchoosek(2:K,n-1); m = size(c,1); ...

12 years ago | 2

| accepted

Answered
MSE between a set of data points (x,y) and a defined line
Before you carry out your integration it is necessary to establish the y-values for your ideal straight line at the correspondin...

12 years ago | 1

Answered
How to solve simultaneous trigonometric equation with summation from n=1 to inf. ?
I think you will find that if x satisfies the inequalities 0<x<1, your infinite series will in fact be convergent. Otherwise th...

12 years ago | 1

| accepted

Answered
Computing the Inverse of Co-variance Matrix results in "Inf". What could be the problem?
It is inherent in the definition of the Mahalanobis distance of a set of observations from a group of sets of observations, that...

12 years ago | 1

| accepted

Load more