Answered
How to interpretate numbers below de MATLAB precision
You may have a misunderstanding of double precision floating point numbers, Fidel. The number 2.2204e-16 is the value of the le...

11 years ago | 1

Answered
How to create a m by n matrix in which each element be another p by q matrix?
You cannot do that with matrices. Each of their elements must be a single scalar quantity. However, you can do such things usi...

11 years ago | 2

Answered
Power or Sum first
As it stands, the summation occurs first, followed by taking the square of that sum. You should be able to determine that from ...

11 years ago | 1

| accepted

Answered
how to input each element (different) of a matrix 'R' in same function 'f' and compute result in the matrix form?
You need dots on the last line: f = (2 * R / (N * b^2)) .* exp(-(R.^2) / (N * b^2))

11 years ago | 0

Answered
How to compute an associated legendre function given by P(n,a*m/b,x)?
For a non-integer value of the order, I believe the Legendre function can be evaluated using matlab's 'gamma' and 'hypergeom' fu...

11 years ago | 1

| accepted

Answered
I'm using a for loop to create a new random variable X with range [0 1], I want the forloop to ignore values above 1 and iterate untill all the values are in range.
I am guessing that what you actually want is the following. It will give you 200 values in X which are all less than or equal t...

11 years ago | 0

Answered
Randomly generated row matrix B with constraints?
I think this is what you want, Laurie, assuming A elements are all non-negative integers. B = floor((A+1).*rand(size(A)));...

11 years ago | 0

Answered
Randomly generated row matrix B with constraints?
I don't understand what you mean in the sentence "I also need a 0 to be a possible randomly generated number in Matrix B". For ...

11 years ago | 1

Answered
Fourth order approx. of first derivative.
Your code for 'D' has an error. You have multiplied by 'h' instead of dividing by it. The code should read: D = (1/12./h...

11 years ago | 1

| accepted

Answered
How can I find the angle between two vectors, including directional information?
If v1 = [x1,y1] and v2 = [x2,y2] are the components of two vectors, then a = atan2d(x1*y2-y1*x2,x1*x2+y1*y2); gives the...

11 years ago | 13

| accepted

Answered
Finding the elements in two matrices with different sizes?
You can also use 'ismember': C = B(ismember(B,A));

11 years ago | 0

| accepted

Answered
Performing integral trapz-error invalid permutation index
Apparently you wish to find the integral of the function 'Fun' with respect to 'Vg'. If so, the line IntNs(t) = trapz(Vg,...

11 years ago | 0

Answered
Regarding random generation of elements in a matrix.
You stated "at max two ones", Abhinav. If you want to include the cases where there are less than two 1's, you could do it this...

11 years ago | 0

Answered
eval giving the wrong mathematical answer
In matlab the 'log' function is considered to be the natural logarithm with base e, not 10. Therefore 3.3863 is the correct ans...

11 years ago | 1

Answered
angle output vs. atan2 output
Yes, they should be the same, provided that X and Y are real numbers or real arrays.

11 years ago | 1

| accepted

Answered
why, if I have data highly correlated, i obtain Ill-conditioned covariance when i use fitgmdist?
Just suppose that the correlation between each pair is one. Then the correlation matrix would consist of all ones and such a ma...

11 years ago | 0

Answered
WHY THIS CODE IS SHOWING ERROR ?
The usage of 'input' is invalid. It cannot accept more than two inputs. Moreover it is unable to print out the values of i-1 a...

11 years ago | 0

Answered
Size information is inconsistent.
In 'trirnd' you must have either three arguments or five, not four. If you want a column vector of 10000 elements, write: ...

11 years ago | 0

Answered
Finding coefficients of a polynomial from roots
If r1, r2, and r3 are the roots, then a polynomial with those roots is: p(x) = (x-r1)*(x-r2)*(x-r3) = x^3-(r1+r2+r3)*x^2+(r2...

11 years ago | 0

Answered
solve 3 degree of freedom vibrational problem without using numerical integration like ode solvers
I will give only a partial answer here and leave much of the work to you, Eswar. It is known in the theory of ordinary differ...

11 years ago | 0

Answered
How can I obtain the derivative of a vector?
You can get an approximation to the derivative of dx1, dx2, and dx3 using matlab's 'gradient' function. If you would prefer a h...

11 years ago | 1

Answered
Why won't it go through the ifelse statement when the if statement isn't satisfied?
It is highly unlikely that any random element in the second row of A would happen to be exactly equal to the maximum integer of ...

11 years ago | 1

| accepted

Answered
Trouble with finding the surface area given surface triangles their vertices and the vertices' normals
There should be no need to use 'trapz' in this problem. Just sum the areas of the triangles, making sure that you have the posit...

11 years ago | 3

| accepted

Answered
Solve Trancedental equation with two dependent variables
Use 'fzero'. It is helpful to first make a plot of the left side of your equation as a function of omega to get an initial omeg...

11 years ago | 0

Answered
How do I wrap text using the disp or display function?
I suggest using 'fprintf' instead of 'disp'. The "\n" symbol will give a new line.

11 years ago | 0

Answered
Using an apostrophe with fprintf
Use double apostrophe just as you would in any matlab string: fprintf('Avogadro''s constant is 6.022e+23 molecules/mole.\n...

11 years ago | 0

Answered
Getting largest to lowest values from a row
Let A be your original matrix. B = [sort(A(2,:),'descend');sort(A(3,:),'ascend')]; B = B(:);

11 years ago | 1

Answered
What function do I use to generate a matrix with the values in specific increments?
I think you mean something like this: incr = rand(1,n); % Variable increments x = cumsum(incr); % Variable with 'inc...

11 years ago | 0

Answered
How do I reverse a vector?
x = fliplr(x);

11 years ago | 1

Answered
Why am i recieving a "parse" error?
You can't write your function that way. Write it this way: function y = trigC(x) y = cos(5*x); end Because of...

11 years ago | 3

| accepted

Load more