Community Profile

# John D'Errico

### Retired

Last seen: Today Active since 2006

DON'T contact me. I won't answer questions. PERIOD. I don't do your homework. I won't do consulting. A retired mathematician, numerical analyst, woodworker, bridge player.

All

#### Content Feed

View by

How to generate two random where the distance between is within a range
Can you "say" that? Um, yes. But then you need to write the code. Given one known point, now you want to find another randomly ...

18 hours ago | 0

| accepted

how do i integrate one vector by using "intergral function" and not trapz ?
You cannot use the intergral function, as it does not exist. You could use integral, almost. :) Except that it does not apply to...

1 day ago | 0

how to get the argument and the modulus of a analytic complex function?
The use of mod as the name of a variable is a REALLY bad idea. Soon, when you begin using MATLAB more, you will trip over things...

1 day ago | 0

unrecognized functions or variable
You don't import a function into MATLAB. Perhaps you are thinking Python, or some similar environment. It looks like onehotenco...

1 day ago | 0

Fit power function to data (optimization)
Your problem is, you are trying to use LEAST squares. But look carefully at your data. xdata = [0.02 0.05 0.1 0.2 0.3 0.4 0.5];...

2 days ago | 0

need help with this my fsolve is not working
You were close. And I think what you did wrong was not completely obvious. Your function is below. First, BEFORE YOU EVER TRY t...

2 days ago | 2

| accepted

How to rearrange an equation in matlab to get the poles?
Vs = 1; Z0 = 50; R = 50; C = 1e-9; L = 0; syms s %Where s = j*w %Impedance of the resistor ZR = R; %Impedance of the ca...

3 days ago | 0

How to find baseline intensity in noisy mass spectra?
First, define baseline. Is it the lowest value the signal does not drop below? If so, then the baseline is trivial to estimate. ...

4 days ago | 0

Integration of a function
Integral is a NUMERICAL tool for integration, uing adaptive numerical methods. It will return a NUMERICAL result, and only appli...

5 days ago | 0

Best choice of fmincon algorithm for high-cost 1D convex problem with "stochastic" gradient information?
A 1-d problem, so ONE unknown? Don't use fmincon at all! And if you wish to supply the gradient, then you cannot supply only a...

6 days ago | 0

Feature Request: Set Logarithmic axes in the 'Distribution Fitter' tool
Answers is NOT the place to submit feature requests. We are not customer support. We are not any kind of official support. If y...

6 days ago | 0

Optimize two variables under two conditions
Um, you cannot optimize TWO things at once. There is no reason to assume that they will both achieve their respective optimal ...

6 days ago | 0

| accepted

How to make a data set periodic?
How do you MAKE it periodic? It is either periodic or it is is not. Is the value at 0 the same as that at 2*pi? If not, then wha...

7 days ago | 0

I want help in writing a matlab code so that I wouldn't have to manually input the various steps as I have shown below. Thanks
R is a matrix. So the statemen while R is meaningless. As well, this if statement if R <= 0.0001; break en...

8 days ago | 0

'manual' t-test gives different result for same t-value
I think you misunderstand what a pdf is, when to use a cdf versus a pdf, or perhaps how the t-test works. Maybe all of those are...

9 days ago | 0

| accepted

ode does not appear to give correct answer
I think you misunderstand what is happening. You get a constant in there, in the form of 2*c. But is c an unknown constant? Wou...

9 days ago | 0

| accepted

fsolve function random value gives the same output as random value
First, always test how your function operates. That will verify it produces what you expect. theta(ones(5,5)) theta(rand(5,5))...

9 days ago | 0

Matlab wouldn't find simple inverse
There is another possibly more important problem, beyond those mentioned by @Yongjian Feng. While you may, personally think the...

9 days ago | 1

| accepted

Converting base N to base 10
Why would you special case base 16 anyway? What if they gave you base 15? Or base 19? Or base 12? It is a really bad coding st...

9 days ago | 0

| accepted

how can i multiply two complex number in GUI
What is the problem? Convert them to numbers. Multiply said numbers. Then output the result however you desire. My guess is you...

10 days ago | 0

How to remove Outliers
The obvious answer is to look at the tools provided in MATLAB. Thus RMOUTLIERS, ISOUTLIER, etc. They are provided in the stats t...

10 days ago | 0

How to format my code in this way? Is there any shortcut?
If you put it in as a picture, then of course not! However, if you paste in the code, then note there is a toolbar on top of th...

10 days ago | 0

How to match column of a one matrix with another column of second matrix?
A = [ 0 0 3 0 2 3 1 2 0 1 0 0]; B = [ 0 3 0 2 3 0 2 ...

11 days ago | 0

| accepted

So I tried to write on the screen symsum results, but one of them got a little bit wrong position
syms n fprintf('a) %f\n',symsum((n+3^n)^-1,n,1,2021)) fprintf('b) %f\n',symsum((2*n+1)^n/n^(2*n),n,1,2021)) fprintf('c) %f\n'...

11 days ago | 0

Is it possible to use the colormap "Purples" in MATLAB, which maps zeros to white?
Um, trivially, yes. (Ok, maybe not trivial. But not difficult.) The biggest question is just to recognize what you want to call ...

11 days ago | 1

| accepted

Create a block diagonal, Toeplitz and triangular matrix given by n,B,C,A
The simplest answer is to use my blktridiag utility from the file exchange. full(blktridiag(A,C,B,3)) ans = 1 2 9 ...

11 days ago | 1

Finding the number of values about nonlinear equations.
You need to understand it is IMPOSSIBLE to know the number of solutions to a general nonlinear equation, or system of them. I...

12 days ago | 0

| accepted

How to integrate between 2 points of a given array.
idx1 idx1 = 2629 idx2 idx2 = 2622 So then what did you do? In order to understand (and then fix) the problem, you need t...

12 days ago | 0

| accepted