# John D'Errico

### Retired

A retired applied mathematician, consultant, sometime mechanical engineer, numerical analyst, woodworker, bridge player. Please DON'T contact me, as too many students then decide I am their personal consultant if I allow it. I won't do consulting by mail.

**Statistics**

RANK**11**

of 279,877

REPUTATION**19,994**

CONTRIBUTIONS

**15** Questions

**7,071** Answers

ANSWER ACCEPTANCE **
40.0%
**

VOTES RECEIVED**4,297**

RANK**4** of 18,773

REPUTATION**63,440**

AVERAGE RATING**4.80**

CONTRIBUTIONS**62** Files

DOWNLOADS **1362**

ALL TIME DOWNLOADS**571554**

CONTRIBUTIONS**0 Posts**

CONTRIBUTIONS**0** Public Channels

AVERAGE RATING

CONTRIBUTIONS**1** Highlight

AVERAGE NO. OF LIKES**8**

**Content Feed**

Fsolve produces comlex numbers

Remember that fsolve does not allow constraints. Not even bound constraints. So when one of the variables tries to go into a bad...

2 hours ago | 0

Optimisation Algorithm and Levenberg-Marquardt for fitglm in MATLAB

The important thing you need to recognize is that fitglm fits a LINEAR model. No nonlinear iterations will be performed. fitgl...

12 hours ago | 0

error in the process of symbol operation of the matrix

Why do you think there is something wrong with T? We don't know why you wrote this code. It computes what you told MATLAB to com...

13 hours ago | 0

Is it possible to plot a curve with changing colours under a single plot?

Arguably, this is something the line function would allow you to do. But line allows you to specify only a single color for an e...

1 day ago | 0

| accepted

Find value at which a line changes its slope

There is NO exact point where that can be known to happen. Your curve is noisy. At best, you can estimate where the curve start...

1 day ago | 0

How do I get random variables generated from a distribution in [-1, 1]?

The MATLAB crystal ball is foggy today. You give us a tiny fragment of code, and then tell us that something strange happens. PR...

1 day ago | 0

Can Simulink use symbolic constants (syms x, y, z) or only numerical values (x=1, y=2, z=3) are accepted ?

NO. Simulink will NOT use symbolic parameters. Sorry. Simulink is essentially a numerical solver. It does not perform symbolic c...

2 days ago | 0

| accepted

three order complex coefficient polynomial root matlab

Another classic solution is to find the matrix that has the same eigenvalues as your polynomial has roots. Then use eig to compu...

3 days ago | 1

Problem with making cash change

Now that you have an answer, I'll add one that is not solved the way you would do so, but using an ILP solver, so an Integer Lin...

3 days ago | 1

How do I code for optimization of max volume of box?

It would arguably be a good time to learn about something called Lagrange multipliers. They allow you to build constraints into ...

3 days ago | 0

write down a function

There is no "function". It sounds as if, given vectors x and h, you want to know what the function would have been, as if MATLAB...

3 days ago | 0

Using find to determine equality not of scalars, but vectors

This is not really the province of find. Yes, you can break an egg with a hammer, but it is not really the right tool for the pu...

3 days ago | 2

How to do a Taylor expansion with a matrix

You cannot compute the Taylor series of a constant. You CAN compute a Taylor series, and then evaluate it at that constant value...

3 days ago | 0

Is it possible to truncate a vector to form one of lower dimension?

You have two choices. First, you can extract the elements you want. Or you can delete the elements you wnat to drop. For example...

4 days ago | 1

Most efficient way to put vector on the off-diagonal of the blocks of a block matrix

The most efficient way? SPDIAGS. help spdiags For example, to create a 6x6 sparse matrix, with an upper and lower diagonal ele...

6 days ago | 0

xy+y^5+3=0 My input is real x, from this implicit equation y will have both real and imag values for each x I want to plot a 3 D plot where z will represent imag y. Pleasehelp

Simple enough. Just do exactly what you asked. Remember the roots of a 5th degree polynomial will in general have no algebraic s...

6 days ago | 0

How do I fit two data sets to each other?

This is a classic problem of calibration. You have two curves, one of which must be shifted (translated) to the other. In some c...

7 days ago | 1

Pick a value with some probability

Please stop asking the same question. There is NO way to know what distribution any set of data comes from. You can use tools to...

7 days ago | 0

Why is the calculated Rsquare different between the embedded fit function and the EzyFit function (from File Exchange)?

Do you understand that R^2 is not valid, when computed for a model with no constant term? Instead, I recall there are variations...

8 days ago | 1

| accepted

I wanna implement this function, but it says there is an syntax error..

What langiuage are you using when you end a function with the statement endfunction? Not MATLAB. As well, IF you had posted the...

8 days ago | 0

| accepted

non-numerical answer for solving complex non-linear equation

I think you do not understand how variables work in MATLAB. Variables are dynamically assigned. When you assign them as you have...

11 days ago | 0

Can I use my student license for and at work?

I would guess the answer is technically no. But it is arguable either way as long as you remain a student, IF when you are on co...

11 days ago | 1

A single precision matrix multiplication problem

Why are you confused? NEVER trust the least significant bits of a floating point number. The numbers in a are singles. So the l...

11 days ago | 3

| accepted

I am stuck in making the pentadiagonal matrix A

This sort of thing is a BAD idea: A = A+spdiags(s_vec, 0, (nx+1)*(ny+1), (nx+1)*(ny+1)); % Add s to the main diagonal of A XX_...

12 days ago | 0

Find the derivative of a spline curve obtained using cscvn

No. There is no simple "function" of a spline. It is a mess of coefficients that by themselves are fairly meaningless to those w...

13 days ago | 0

Fitting powerlaw between two points

Given two points exactly, thus: yx = [0.047 100; 0.0382 0.1933]; y1 = yx(:,1); x1 = yx(:,2); You want the power law cur...

13 days ago | 0

| accepted

How to combine the trapezoidal rule with interpolation in ode23t function

A FREE interpolant is one where the nodes are not fixed in advance. For example, suppose I choose to interpolate sin(x), on th...

13 days ago | 0

How to get the combination "nCk", if either n or k is a variable.

if x(3) is NOT an integer, then what do you expect? If x(3) is NOT at least as large as d, then what do you expect? In either...

13 days ago | 0

Fitting 3D data into a function

The curve fitting toolbox does not fit models with more than 2 independent variables. You can use my polyfitn tool, found on th...

14 days ago | 1

| accepted

How to solve exponential variables

The problem is, you have been trying to SOLVE them. More approproately, you want to use a tool that will FIT your model to the...

14 days ago | 0