Answered

Generate Random Number inside a closed area

Not hard. But it takes a little effort. (I should post a tool for this on the FEX. SIGH. Actually, I have a tool that does this,...

Generate Random Number inside a closed area

Not hard. But it takes a little effort. (I should post a tool for this on the FEX. SIGH. Actually, I have a tool that does this,...

14 jours ago | 2

| accepted

Answered

What starting point to choose so fsolve always returns a solution when any exists?

I tend to describe tools like fsolve with a metaphor of a blind man set down on the surface of the earth, then tasked with findi...

What starting point to choose so fsolve always returns a solution when any exists?

I tend to describe tools like fsolve with a metaphor of a blind man set down on the surface of the earth, then tasked with findi...

14 jours ago | 1

| accepted

Answered

How to use DWT for denoising complex data like OFDM symbol ?

So why not just denoise the real and imaginary parts separately, then combine them back into one complex array. Two calls instea...

How to use DWT for denoising complex data like OFDM symbol ?

So why not just denoise the real and imaginary parts separately, then combine them back into one complex array. Two calls instea...

15 jours ago | 0

Answered

icdf versus erfinv?

In general, use the ICDF code! Why would it be more accurate? Because it can be more intelligent, using a more accurate approxi...

icdf versus erfinv?

In general, use the ICDF code! Why would it be more accurate? Because it can be more intelligent, using a more accurate approxi...

15 jours ago | 1

| accepted

Answered

how do I calculate pi

Easy. Type pi at the command line. Works like a charm. Harder, since you did make a very credible effort at a solution, first, ...

how do I calculate pi

Easy. Type pi at the command line. Works like a charm. Harder, since you did make a very credible effort at a solution, first, ...

15 jours ago | 0

| accepted

Answered

how to set initial guesses in Curve fitting to avoid the local minimum?

As Alex says, it is not easy, and no perfect answer exists. The model you have posed is a difficult one to estimate, because i...

how to set initial guesses in Curve fitting to avoid the local minimum?

As Alex says, it is not easy, and no perfect answer exists. The model you have posed is a difficult one to estimate, because i...

15 jours ago | 1

| accepted

Answered

How to multiply the different values of same variables

And the problem is? P = 1; for i = 1:Imdone x = (stuff) P = P*x; end

How to multiply the different values of same variables

And the problem is? P = 1; for i = 1:Imdone x = (stuff) P = P*x; end

16 jours ago | 0

Answered

Rearrange randomly just some parts of an array

I fail to see the problem, although you are the only one who knows the rules that created this vector, so you will know what to ...

Rearrange randomly just some parts of an array

I fail to see the problem, although you are the only one who knows the rules that created this vector, so you will know what to ...

16 jours ago | 0

Answered

How to generate a vector with specific values (maybe using loops)?

Don't. Instead, use arrays to store them. n = 4; V = eye(n); V V = 1 0 0 0 0 1 0 0 ...

How to generate a vector with specific values (maybe using loops)?

Don't. Instead, use arrays to store them. n = 4; V = eye(n); V V = 1 0 0 0 0 1 0 0 ...

16 jours ago | 0

Answered

Defining non-coefficient constant in fittype

While this is trivial to solve using the CFTB (that is, fit) it is even simpler to solve using backslash. Assume that omega1 an...

Defining non-coefficient constant in fittype

While this is trivial to solve using the CFTB (that is, fit) it is even simpler to solve using backslash. Assume that omega1 an...

17 jours ago | 0

| accepted

Answered

How to write log base e in MATLAB?

The log function does exactly what you want. log(14 - y) If you want a base 10 log, you use log10. There is also a log2 functi...

How to write log base e in MATLAB?

The log function does exactly what you want. log(14 - y) If you want a base 10 log, you use log10. There is also a log2 functi...

18 jours ago | 2

Answered

Precision in calculation of large digits

What you need to understand is how MATLAB works. When you have one function call another, it evaluates the inside operation FIRS...

Precision in calculation of large digits

What you need to understand is how MATLAB works. When you have one function call another, it evaluates the inside operation FIRS...

18 jours ago | 2

Answered

Multiplying every secound element in a vector with -1

You need to start learning MATLAB. That is, actually learn to use vectors, matrices, not just work with single numbers, and loop...

Multiplying every secound element in a vector with -1

You need to start learning MATLAB. That is, actually learn to use vectors, matrices, not just work with single numbers, and loop...

18 jours ago | 1

| accepted

Answered

Surf plots 2D + color. I want a 3D plot. What is the solution?

But what you have, that is z(x,y), is a 2-dimensional manifold in R^3, that is, a surface embedded in the 3-dimensional cartesia...

Surf plots 2D + color. I want a 3D plot. What is the solution?

But what you have, that is z(x,y), is a 2-dimensional manifold in R^3, that is, a surface embedded in the 3-dimensional cartesia...

18 jours ago | 1

| accepted

Answered

How to use interp1 to stretch out smaller vector to the size of larger vector?

Assuming that you intend to create a vector of averages, do this: Ahat = interp1(1:1260,A,linspace(1,1260,1778)); C = (Ahat ...

How to use interp1 to stretch out smaller vector to the size of larger vector?

Assuming that you intend to create a vector of averages, do this: Ahat = interp1(1:1260,A,linspace(1,1260,1778)); C = (Ahat ...

18 jours ago | 1

| accepted

Answered

Collecting terms / factoring out multiplied terms

Be serious. That is not big. There are some things (this is one of them) that are far simpler to do by pencil and paper than to ...

Collecting terms / factoring out multiplied terms

Be serious. That is not big. There are some things (this is one of them) that are far simpler to do by pencil and paper than to ...

19 jours ago | 0

Answered

Less time consuming substitution for if conditional

I think you are focusing on the wrong things. This is NOT a slow operation. Very likely, this is part of a large, inefficiently...

Less time consuming substitution for if conditional

I think you are focusing on the wrong things. This is NOT a slow operation. Very likely, this is part of a large, inefficiently...

19 jours ago | 0

Answered

How do I do this function?

x = -1:0.1:1; f = x.^2.*sin(pi.*x); g = max(0,f);

How do I do this function?

x = -1:0.1:1; f = x.^2.*sin(pi.*x); g = max(0,f);

19 jours ago | 0

Answered

How can I fit data to a sine curve?

I'll guess the model you want is as below, but use the curve fitting toolbox. Your model might be defined as: ft = fittype('si...

How can I fit data to a sine curve?

I'll guess the model you want is as below, but use the curve fitting toolbox. Your model might be defined as: ft = fittype('si...

20 jours ago | 0

Answered

How to implement an equality and inequality constraint

You said both an equality AND an inequality constraint in the subject. But then you showed only the inequality. The inequality ...

How to implement an equality and inequality constraint

You said both an equality AND an inequality constraint in the subject. But then you showed only the inequality. The inequality ...

21 jours ago | 0

| accepted

Answered

How do you get the equations of shape-preserving fitting method automatically?

The problem that Matt is getting at is, the equation of a set of points as fit by any spline (including shape preserving interpo...

How do you get the equations of shape-preserving fitting method automatically?

The problem that Matt is getting at is, the equation of a set of points as fit by any spline (including shape preserving interpo...

21 jours ago | 2

| accepted

Answered

Why do I keep getting the error message array indices must be positive integers or logical values?

MATLAB has an index origin of 1, not 0. So X(0) will fail, and give you exactly that error. (Matt pointed that out.) But also ...

Why do I keep getting the error message array indices must be positive integers or logical values?

MATLAB has an index origin of 1, not 0. So X(0) will fail, and give you exactly that error. (Matt pointed that out.) But also ...

22 jours ago | 0

Answered

How do I solve this system of equations for real number?

Whats the problem? There appear to be six real solutions. Solve finds them with no problem. xyz = solve(eqn1,eqn2,eqn3) xyz = ...

How do I solve this system of equations for real number?

Whats the problem? There appear to be six real solutions. Solve finds them with no problem. xyz = solve(eqn1,eqn2,eqn3) xyz = ...

22 jours ago | 0

Answered

Fitting a natural log curve

Um, a log curve does not have that shape. (Natural or not.) So trying to use a log function to fit that data will not leave you ...

Fitting a natural log curve

Um, a log curve does not have that shape. (Natural or not.) So trying to use a log function to fit that data will not leave you ...

22 jours ago | 0

Answered

Two dimensional interpolation polynomial

I don't think you realize that an interpolation polynomial that passes exctly through 300321 points will be impossible to evalua...

Two dimensional interpolation polynomial

I don't think you realize that an interpolation polynomial that passes exctly through 300321 points will be impossible to evalua...

23 jours ago | 0

Answered

Create an ellipse with equal distance between two points

The simplest way to do this is to use my interparc tool. Just take the set of points on the ellipse. Then pass them into interp...

Create an ellipse with equal distance between two points

The simplest way to do this is to use my interparc tool. Just take the set of points on the ellipse. Then pass them into interp...

23 jours ago | 2

| accepted

Answered

Plot is a straight line when it should be a curve.

Is it really a straight line? Seriously? Did you look CAREFULLY at the curve? A PERFECTLY STRAIGHT LINE? (No.) I'll admit that t...

Plot is a straight line when it should be a curve.

Is it really a straight line? Seriously? Did you look CAREFULLY at the curve? A PERFECTLY STRAIGHT LINE? (No.) I'll admit that t...

23 jours ago | 1

Answered

Generating sequences from data

So, given a vector x, of length n, you want to create the array with rows that are the sub-sequences of length 5? The result wil...

Generating sequences from data

So, given a vector x, of length n, you want to create the array with rows that are the sub-sequences of length 5? The result wil...

24 jours ago | 1

Answered

Integral of a surface bounded by 2 hyperbolas

This is not a problem that MATLAB cannot handle something. It is a problem of using the wrong tool. Integrate is a curve fittin...

Integral of a surface bounded by 2 hyperbolas

This is not a problem that MATLAB cannot handle something. It is a problem of using the wrong tool. Integrate is a curve fittin...

24 jours ago | 0

| accepted

Answered

Weird numerical integration behavior

No. You should NOT make it inf. Even 1e24 is incredibly large, wild overkill. As to why you are using integral to compute the a...

Weird numerical integration behavior

No. You should NOT make it inf. Even 1e24 is incredibly large, wild overkill. As to why you are using integral to compute the a...

25 jours ago | 0

| accepted