Answered
Find position of when 0 goes to 1
help strfind It works with numbers too. X= rand(1,10)> 0.5 X = 1×10 logical array 0 0 0 0 1 1 ...

8 years ago | 1

| accepted

Answered
What is meant by "centered moving average" ? Is it different from 'moving average'?
A rose by any other name would smell as sweet... So, given the sequence X = [1 2 6 4 3 7]; and a 3 point moving avera...

8 years ago | 1

| accepted

Answered
Non-Linear Regression Methods
READ THE HELP. For example, a fragment of the help for fitnlm: NLM = fitnlm(X,Y,MODELFUN,BETA0) fits a nonlinear regress...

8 years ago | 0

| accepted

Answered
Wrong numerical integration value but no error
Here is the code you wrote: fct_bad = @(tau,theta) ((1+cosh(2*tau*theta))/(sinh(2*pi*tau)))*tanh((pi-theta)*tau); Lets p...

8 years ago | 1

Answered
How do I plot a curved best fit line of the data below? Using fitnlm has been recommended.
fitnlm will do nothing, UNLESS you have a model. And if you have no clue as to what model is appropriate, then the first thing y...

8 years ago | 1

Answered
how I found W1,W2 ?
Huh? First, you would simply minimize f = w1*F1(x) - w2*F2(x) for some choice of positive w1 and w2. But ONLY YO...

8 years ago | 0

Answered
Why do I get this error? Subscript indices must either be real positive integers or logicals.
Well, you could ask the author. But that was probably you, since nobody I know of would admit to having written such a convolute...

8 years ago | 0

Answered
if within while loop not recognized
NEVER test for exact equality of a floating point number. Since doubles are stored in binary, remember that almost all decima...

8 years ago | 1

Answered
how to solve a set of nonlinear and nonquadratic equations
Simplest to do this symbolically, since there will be many solutions. As = 0.19; S = 1366; sigma = 5.67e-8; %Stefan ...

8 years ago | 1

Answered
Convolution of a function g(x) and the dirac delta function.
Works for me. G = rand(1,10); Gconv = conv(G,1); norm(G-Gconv) ans = 0 WTP? If you did something differ...

8 years ago | 0

| accepted

Answered
i want to generate ones in consecutive random positions in a vector of zeros for example i want to generate 5 ones in consecutive positions in a specific range lets say from position 5 to position 15 assuming that the vector has 48 positions
Start with a vector of zeros. Now, if you want sequence of 5 ones, starting from some random point, then just pick the start...

8 years ago | 0

| accepted

Answered
logical less than thinks values are the same?
You don't seem to believe what we are telling you. Here is 1. num2hex(1) ans = '3ff0000000000000' That is 1. ...

8 years ago | 0

Answered
Implement the Travelling salesman problem
Your problem is here: tspsol = solve(tsp,'options',opts) which should be: tspsol = solve(tsp,opts) tspsol = ...

8 years ago | 0

| accepted

Answered
How to use the min() and max() functions?
If you want to use min or max, then don't name a variable with the name min, or max. which min -all which max -all Wh...

8 years ago | 0

| accepted

Answered
How o check if a number is a power of 3
What you are trying to do is a good start. But you probably need to use a tolerance, as I show. You can only test to see if t...

8 years ago | 0

| accepted

Answered
Calculation of probability using Beta ,lognormal and weibull distribution
I think you are making what is a fairly common mistake about continuous probability distributions. Suppose you have a 6 sided...

8 years ago | 0

Answered
lasso regression non-positive constraints
Suppose you were to just negate your dependent variable? Solve now, using non-negative solver. You already know how to use th...

8 years ago | 1

Answered
Combining 2 vectors?
You created a1 as a1 = [1,2,3,4,5,6]; and a2 as a2 = [7,8,9,10,11]; So why would you not be able to create a3 a...

8 years ago | 1

| accepted

Answered
How to deal with the matrix with the size of 5000000*8760
I still do not see you say what you are doing with the matrix. "downstream processing" is not sufficient information. There m...

8 years ago | 1

Answered
Solving non-linear trigonometric equations with two unknowns.
Too easy? Eliminate Z1, by taking the ratio. B1=1/(Z1*tan(x)) B2=1/(Z1*tan(r*x)) Therefore, B2/B1 = tan(x)/ta...

8 years ago | 2

| accepted

Answered
my own function is not working with 3x^2-12-15=0
First, verify that your solution is correct. roots([3 -12 -15]) ans = 5 -1 Homework is good. Learn to ...

8 years ago | 2

| accepted

Answered
Fitting data in second order polynomial
There is a lot here to say. I'll try to do so in a fairly intuitive way, while going a bit light on rigor. Assume you have a pro...

8 years ago | 3

| accepted

Answered
How to convert these numbers to vector? size (1*1000)
str=['73167176531330624919225119674426574742355349194934',... '96983520312774506326239578318016984801869478851843',... ...

8 years ago | 0

Answered
how to generate random number between 10^-6 to 10^-50
RAND produces a UNIFORMLY distributed random number. Do you know what the probability that a uniformly distributed random nu...

8 years ago | 2

| accepted

Answered
Steady State and Transition probablities from Markov Chain
Lets say you have some Markov transition matrix, M. We know that at steady state, there is some row vector P, such that P*M =...

8 years ago | 4

| accepted

Answered
Reshaping drastically improves the speed of my program. 16x16 matrix VS 1x256 vector.
We don't know what you mean by "comparing" two matrices. How do you define the distance between two matrices? Speed of code is o...

8 years ago | 0

Answered
'The grid vectors must contain unique points.' error with Interp1
Lets actually plot the data. ALWAYS plot your data. Look at it. Think about what it means. plot(x,y,'.') <</matlabcentra...

8 years ago | 6

Answered
speedup dsearchn for large data set
I'd be looking for a different tool than dsearchn, which has been around a while. knnsearch comes to mind. X = randn(1000,3...

8 years ago | 1

| accepted

Answered
How to store a series of matrices from a for loop?
As long as you can fit them all in memory, it is easiest to just store them in a cell array. 16 images is not that many, so you ...

8 years ago | 2

| accepted

Answered
choose n elements from array and increase sequentially
Problems like this are always solvable in many ways. Easy to write is not always efficient. And there are often tradeoffs due to...

8 years ago | 1

Load more