Beantwortet
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. ...

mehr als 9 Jahre vor | 2

Beantwortet
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...

mehr als 9 Jahre vor | 0

Beantwortet
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...

mehr als 9 Jahre vor | 0

| akzeptiert

Beantwortet
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.

mehr als 9 Jahre vor | 0

Beantwortet
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 ...

mehr als 9 Jahre vor | 1

Beantwortet
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),...

mehr als 9 Jahre vor | 0

| akzeptiert

Beantwortet
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 ...

mehr als 9 Jahre vor | 0

Beantwortet
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...

mehr als 9 Jahre vor | 0

Beantwortet
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...

mehr als 9 Jahre vor | 0

Beantwortet
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...

mehr als 9 Jahre vor | 0

Beantwortet
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...

mehr als 9 Jahre vor | 0

Beantwortet
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 ...

mehr als 9 Jahre vor | 0

Beantwortet
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 ...

mehr als 9 Jahre vor | 0

Beantwortet
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*...

mehr als 9 Jahre vor | 0

| akzeptiert

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

mehr als 9 Jahre vor | 0

| akzeptiert

Beantwortet
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...

mehr als 9 Jahre vor | 0

Beantwortet
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...

mehr als 9 Jahre vor | 2

| akzeptiert

Beantwortet
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...

mehr als 9 Jahre vor | 1

Beantwortet
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...

mehr als 9 Jahre vor | 0

Beantwortet
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...

mehr als 9 Jahre vor | 0

Beantwortet
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...

mehr als 9 Jahre vor | 0

Beantwortet
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...

mehr als 9 Jahre vor | 1

| akzeptiert

Beantwortet
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...

mehr als 9 Jahre vor | 0

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

mehr als 9 Jahre vor | 1

Beantwortet
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...

mehr als 9 Jahre vor | 0

Beantwortet
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...

mehr als 9 Jahre vor | 0

Beantwortet
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...

mehr als 9 Jahre vor | 0

Beantwortet
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)...

mehr als 9 Jahre vor | 0

Beantwortet
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...

mehr als 9 Jahre vor | 2

Mehr laden