Answered
how to rewrite f(x,y)=0 as y=...
This equation can be manipulated so that y is the solution to a twelfth-order polynomial in y with coefficients in terms of x. ...

9 years ago | 2

Answered
Hi.I want to multiply n matrices with k,k+1 dimension and the problem is that if I test the code on paper it seems right but written on matlab well it's a little bit different. here is the code :
All you are going to get with this computation is the first row of the product of these A{...} matrices. The result will theref...

9 years ago | 0

Answered
How to 'carry' matrix index with matrix operations
Use the second quantity returned by the 'sort' function: [b,p] = sort(a); The 'p' is an index for rearranging the first...

9 years ago | 0

| accepted

Answered
find few elements in vector
[~,ia] = intersect(y,x); ia contains indices with respect to y of elements that lie both in y and in x.

9 years ago | 0

Answered
Straight line in 3D between endpoints of x, y, z data. Extract coordinates of straight line in specified positions.
Suppose P1 = [x1;y1;z1] and Pn = [xn;yn;zn] are the endpoints and Pm = [xm;ym;zm] is an intermediate point, each represented as ...

9 years ago | 1

Answered
random number with fixed summation
Use the ‘randperm’ function on each column of f1: f1 = zeros(8,11) for ix = 1:size(f1,2) f1(randperm(size(f1,1),...

9 years ago | 0

| accepted

Answered
MATLAB help with function and while loop?
I see at least four difficulties in your code: a) You shouldn’t use the word ‘sum’ for a variable. Matlab has a function by ...

9 years ago | 0

Answered
Why do I get this error: A(I): index out of bounds; value 2 out of bound 1 (line 13)
Besides the error that Daniel gives you, another error is that ’n’ never changes within your while-loop, so the (corrected) loop...

9 years ago | 0

Answered
Double integral error Matrix dimensions must agree
1. In the expression for ‘p2’ you have “t/tau” which is matrix division. However the sizes of ’t’ and ‘tau’ are incompatible wi...

9 years ago | 0

Answered
I need to write an if statement that says "if variable userValue is equal to the square root of any negative number, then...". The number could be any number you input into the function. How would I do this?
The square root of a real negative number is pure imaginary, so its real part must be zero. Just test that real(s) is zero wher...

9 years ago | 0

Answered
while loop won't run?
I am guessing that you need to change the initial ‘Error’ to: Error = abs(Qdotpv-QHdot); %W As you have it, if the erro...

9 years ago | 0

Answered
Estimating pi using while loop for specific tolerence.
The difference between the finite sum 1+1/4+1/9+...+1/N^2 and the infinite sum is proportional to 1/N. Therefore each time you ...

9 years ago | 0

Answered
What is MATLAB's algorithm for calculating integral error?
Obviously Matlab’s ‘integral’ function cannot know the exact value of the given integral since it is limited to a finite number ...

9 years ago | 0

Answered
How can I iteratively solve an algebraic equation?
My primitive version of ‘solve’ gives a non-iterative solution for x in terms of the “lambertw” function: x = -200/9*(9/50*...

9 years ago | 0

| accepted

Answered
Combinations of a single vector
You can use ‘nchoosek’ for that task: C = nchoosek(a,2);

9 years ago | 0

| accepted

Answered
Secant method error, "subscript indicies must be real or positive integers"
You enter the while loop with n = 1. This means that x(n-1) would have an index value of zero. This is a no-no in Matlab. You...

9 years ago | 0

Answered
Calculating normal on a plane: Can't get proper results
You should not be requiring an exact zero for those dot products, since in most circumstances your computations will involve rou...

9 years ago | 2

| accepted

Answered
Cumsum gives different results for double and single
Yes, that is very easily explained. The computations for vector ‘b’ are performed with single precision accuracy, whereas those...

9 years ago | 1

Answered
solving an equation in matlab
I understand that you want to determine the values of Fi in your first RG expression, given m and the coefficients of an equival...

9 years ago | 0

Answered
I am trying to solve this system of linear equations but for some reason I keep getting 0 for the variables and I'm not sure what I am doing wrong
I see one problem. The resulting set of four equations in four unknowns is not linearly independent and therefore has infinitel...

9 years ago | 0

Answered
covariance matrix from a random vector?
With just a vector, Y, you can calculate its variance but there is no significance to calculating its covariance. That would al...

9 years ago | 0

Answered
Why am I getting an array of NaN when using icdf?
The ‘icdf’ function computes the inverse of a cdf function, which means that it receives a probability value or values and obtai...

9 years ago | 1

| accepted

Answered
Determine the roots of the simultaneous nonlinear equation by fixed point iterations
Using your “fixed point” iteration method to solve those two equations is a bad idea. There are much simpler ways of solving su...

9 years ago | 0

Answered
Finding Closest Data Point
I recommend you use the ‘pdist2’ function using the “Smallest” option. It is described at: https://www.mathworks.com/help...

9 years ago | 1

Answered
Maximum recursion limit of 500 reached error in matlab.
The code for ‘randfixedsum’ was written to have each column, not each row, of the resulting matrix x have the given sum s. If y...

9 years ago | 0

Answered
If my K matrix is [17X17] and I want to divide it by a column matrix F=[17X1] how do I do that?
I believe the most likely division you are asking for would divide element-wise the elements of each column of K by those of the...

9 years ago | 0

Answered
Why is my Plot Blank?
You need to index dyds so that it contains a value for each value of ‘theta’: dyds = zeros(1,length(theta)); for k = 1:l...

9 years ago | 0

Answered
Solving an implicit equation for y error
You don’t need ’solve’ for solving for y. It can be obtained in the following equation: y = ∓sqrt(x^7*exp(5*C)/5-4/5*x^2)...

9 years ago | 0

Answered
h = mod(prod(uint8('Welcome42')),2^24-3); returns the wrong result ?
The product, prod(u​int8(‘Welc​ome42’)), is too large an integer to be represented exactly with the 53 bits available for a ‘dou...

9 years ago | 2

Load more