Answered

Find multiple values closest to zero

So, you are telling us that you know how to use a fragment like ind = find(diff(sign(values)))+1 ind = 14 24 27 ...

Find multiple values closest to zero

So, you are telling us that you know how to use a fragment like ind = find(diff(sign(values)))+1 ind = 14 24 27 ...

7 hours ago | 0

Answered

ASSISTANCE ON RUNNING RANDOM VARIABLES IN A FUNCTION

Note that a random variable is a well defined term in mathematics and statistics, though much of the time when I see someone use...

ASSISTANCE ON RUNNING RANDOM VARIABLES IN A FUNCTION

Note that a random variable is a well defined term in mathematics and statistics, though much of the time when I see someone use...

12 hours ago | 0

Answered

How to determine eigenvalues of symbolic matrix?

What form would you expect? Is there a reason why you expect the eigenvalues of a 4x4 symbolic matrix to be some nice pretty thi...

How to determine eigenvalues of symbolic matrix?

What form would you expect? Is there a reason why you expect the eigenvalues of a 4x4 symbolic matrix to be some nice pretty thi...

1 day ago | 0

Answered

fminunc gets first-order optimality of zero on iteration 0, does not find optimum

First, this appears to be a ONE parameter optimization. Do not use fminunc for that. Instead, us fminbnd. It will be more robust...

fminunc gets first-order optimality of zero on iteration 0, does not find optimum

First, this appears to be a ONE parameter optimization. Do not use fminunc for that. Instead, us fminbnd. It will be more robust...

1 day ago | 0

Answered

symbolic toolbox problem ?

A strong possibility is you have overwritten/overloaded the stored value of pi. >> clear pi >> pi ans = 3.1415926...

symbolic toolbox problem ?

A strong possibility is you have overwritten/overloaded the stored value of pi. >> clear pi >> pi ans = 3.1415926...

2 days ago | 0

Answered

Find whether there is a trend over time or the data is completely random

This really is not a MATLAB question, as you have no idea how to compute what you want, and your question is too vague to have a...

Find whether there is a trend over time or the data is completely random

This really is not a MATLAB question, as you have no idea how to compute what you want, and your question is too vague to have a...

3 days ago | 0

Answered

Weighted Least Square Fit regarding equal parts of the xaxis

You can't directly supply weights as an option to laqcurvefit. Better is to use lsqnonlin for this, since you return the residu...

Weighted Least Square Fit regarding equal parts of the xaxis

You can't directly supply weights as an option to laqcurvefit. Better is to use lsqnonlin for this, since you return the residu...

3 days ago | 0

| accepted

Answered

Given that A is a sparse matrix, norm(A(i,:)) takes a very long time. Why and can one do better ?

You really don't want to use loops to do something like this. >> A = sprand(10000,10000,0.001); >> timeit(@() norm(A(1,:)))...

Given that A is a sparse matrix, norm(A(i,:)) takes a very long time. Why and can one do better ?

You really don't want to use loops to do something like this. >> A = sprand(10000,10000,0.001); >> timeit(@() norm(A(1,:)))...

3 days ago | 0

| accepted

Answered

C = union( A,B ) is too slow. Is there any faster way given that A and B are ordered.

You could use unique. It would produce the same result, except that it will not be faster. A = sort(randi(1e7,1,1e6)); B = sor...

C = union( A,B ) is too slow. Is there any faster way given that A and B are ordered.

You could use unique. It would produce the same result, except that it will not be faster. A = sort(randi(1e7,1,1e6)); B = sor...

3 days ago | 0

Answered

Kindly help me to obtain the first four numerical solution of given trancedental equation "luck 1"

Have you not tried plotting it? It is so easy to say that you want the "first" 4 roots. >> vpa(subs(luck1,x,eps)) ans = -1.7...

Kindly help me to obtain the first four numerical solution of given trancedental equation "luck 1"

Have you not tried plotting it? It is so easy to say that you want the "first" 4 roots. >> vpa(subs(luck1,x,eps)) ans = -1.7...

4 days ago | 0

Answered

How to generate random numbers with constraints and different boundaries (for a high dimension)?

Neither of the choices on the FEX are directly a solution. randfixedsum fails because it explicitly assumes uniform bounds on th...

How to generate random numbers with constraints and different boundaries (for a high dimension)?

Neither of the choices on the FEX are directly a solution. randfixedsum fails because it explicitly assumes uniform bounds on th...

4 days ago | 0

| accepted

Answered

finding roots of equation in matlab

In general the roots of a 6th degree polynomial with unknown coefficients cannot be found in an algebraic form. At least not unl...

finding roots of equation in matlab

In general the roots of a 6th degree polynomial with unknown coefficients cannot be found in an algebraic form. At least not unl...

5 days ago | 1

Answered

Estimating parameter uncertainty with fminsearch

I think I am starting to understand what you are askng. One very good option is to use abs. I've been told I could use better ab...

Estimating parameter uncertainty with fminsearch

I think I am starting to understand what you are askng. One very good option is to use abs. I've been told I could use better ab...

5 days ago | 0

| accepted

Answered

How can i randomly insert 14 1's in a array of two thousand zeros?

A = zeros(1,2000); A(randperm(2000,14)) = 1;

How can i randomly insert 14 1's in a array of two thousand zeros?

A = zeros(1,2000); A(randperm(2000,14)) = 1;

6 days ago | 2

| accepted

Answered

How to solve this ode problem

Use none of them. This is NOT an ODE problem, except that you seemed to want to write it as such. It is certainly not something ...

How to solve this ode problem

Use none of them. This is NOT an ODE problem, except that you seemed to want to write it as such. It is certainly not something ...

6 days ago | 0

| accepted

Answered

Calculate the distance between a linear regression line and the data points

I am confident that what you are asking is an orthogonal distance, not the vertical difference, frequently known as the residual...

Calculate the distance between a linear regression line and the data points

I am confident that what you are asking is an orthogonal distance, not the vertical difference, frequently known as the residual...

7 days ago | 0

Answered

How do I get the intersection function of 2 surfaces?

The intersection function will rarely exist as a "function". At best, it is an implicit function, thus a problem with solution l...

How do I get the intersection function of 2 surfaces?

The intersection function will rarely exist as a "function". At best, it is an implicit function, thus a problem with solution l...

9 days ago | 0

Answered

ode,dsolve,spline,ode interp, differantial

You are not asking to do anything more than to integrate a spline, and perhaps to plot the result as a function of x. (You don't...

ode,dsolve,spline,ode interp, differantial

You are not asking to do anything more than to integrate a spline, and perhaps to plot the result as a function of x. (You don't...

9 days ago | 0

| accepted

Answered

Integrating from polyint(p)

Sorry, but polyint cannot integrate a rational polynomial, and certainly not over an infinite region. Depending on the roots of ...

Integrating from polyint(p)

Sorry, but polyint cannot integrate a rational polynomial, and certainly not over an infinite region. Depending on the roots of ...

9 days ago | 0

| accepted

Answered

How to optimize matrix multiplication speed?

Do this: P = PHI*(P + Q)*PHI' + Q; While it may look exactly like the line of code you wrote, in fact, it is the same. Matrix ...

How to optimize matrix multiplication speed?

Do this: P = PHI*(P + Q)*PHI' + Q; While it may look exactly like the line of code you wrote, in fact, it is the same. Matrix ...

9 days ago | 0

| accepted

Answered

Algorithm to extract linearly dependent columns in a matrix

It is difficult to answer this. Consider a simple matrix: format short g A = rand(4,5) A = 0.73796 0.36725 0....

Algorithm to extract linearly dependent columns in a matrix

It is difficult to answer this. Consider a simple matrix: format short g A = rand(4,5) A = 0.73796 0.36725 0....

10 days ago | 0

| accepted

Answered

How can I create a function with random imputs? I have to create a function called tri_area that returns the area of a triangle with abse b and heigh h, where b and h are input arguments of the function in that order

I think you may be confused. I believe what is asked is for a function with ARBITRARY inputs, in the sense it can be called with...

How can I create a function with random imputs? I have to create a function called tri_area that returns the area of a triangle with abse b and heigh h, where b and h are input arguments of the function in that order

I think you may be confused. I believe what is asked is for a function with ARBITRARY inputs, in the sense it can be called with...

10 days ago | 2

Answered

The accuracy on my LSTM deep learning neural network will not exceed 62.96%

You have shown no data, so we cannot truly say if you are doing something wrong. However, it sounds as it what you are doing is:...

The accuracy on my LSTM deep learning neural network will not exceed 62.96%

You have shown no data, so we cannot truly say if you are doing something wrong. However, it sounds as it what you are doing is:...

10 days ago | 0

Answered

how can i get a number as an answer?

You got a number. :) I know, its net a very useful looking number. As s floating point sym, use vpa. vpa((23401992239682647381...

how can i get a number as an answer?

You got a number. :) I know, its net a very useful looking number. As s floating point sym, use vpa. vpa((23401992239682647381...

10 days ago | 0

Answered

why does similar code generate complex numbers?

What, for example, are the THREE cube roots of a negative number? We can find them all as solutions to the equation syms x xs...

why does similar code generate complex numbers?

What, for example, are the THREE cube roots of a negative number? We can find them all as solutions to the equation syms x xs...

11 days ago | 0

Answered

Is there a tool for drawing diagrams that connect equations?

I don't think there is a tool in MATLAB that will take a set of equations in arbitrary order, and then create this diagram. Yo...

Is there a tool for drawing diagrams that connect equations?

I don't think there is a tool in MATLAB that will take a set of equations in arbitrary order, and then create this diagram. Yo...

11 days ago | 0

Answered

How can ı solve this constraint optimization problem?

Many things you can do, but since this is your homework, and there are already answrs posted, I'll just suggest a couple of thin...

How can ı solve this constraint optimization problem?

Many things you can do, but since this is your homework, and there are already answrs posted, I'll just suggest a couple of thin...

11 days ago | 0

Answered

USING MEX TO SPEED UP THE CODE

As a counterpoint, there are some issues to consider. Much of MATLAB is already compiled code, at least in the hard working part...

USING MEX TO SPEED UP THE CODE

As a counterpoint, there are some issues to consider. Much of MATLAB is already compiled code, at least in the hard working part...

11 days ago | 1

| accepted

Answered

help solving differential equations

I think you have multiple problems here, now that you claim to have the correct equation. DSOLVE finds an analytical solution to...

help solving differential equations

I think you have multiple problems here, now that you claim to have the correct equation. DSOLVE finds an analytical solution to...

12 days ago | 0

Answered

Simplifying a algebraic or numeric expression to lowest possible power

The problem is, there are multiple solutions, because sqrt is not as simple a thing as you like. syms x >> y = sqrt(x.^2) y ...

Simplifying a algebraic or numeric expression to lowest possible power

The problem is, there are multiple solutions, because sqrt is not as simple a thing as you like. syms x >> y = sqrt(x.^2) y ...

12 days ago | 0

| accepted