11,807 total contributions since 2012

Hic sunt dracones!

PROFESSIONAL: Physician (M.D.): Diplomate of the American Board of Internal Medicine; M.Sc. Biomedical Engineering: Instrumentation, Signal Processing, Control, System Identification, Parameter Estimation

NON-PROFESSIONAL: Amateur Extra Class Amateur Radio Operator; Private Pilot, Airplane Single Engine Land, Instrument Rating Airplane; Gamer

NOTE: I do not respond to emails or personal messages, unless they are about my File Exchange contributions.

Answered

Estimating multiple parameters from a regression

That is a simple linear regression. Try this: B = [x1 x2 u] \ fy; a = B(1) b = B(2) c = B(3)

Estimating multiple parameters from a regression

That is a simple linear regression. Try this: B = [x1 x2 u] \ fy; a = B(1) b = B(2) c = B(3)

2 hours ago | 0

| accepted

Answered

How to find centroid or center of a 3D irregular shape

The centroid is defined as the arithmetic mean of the points, so just do that in each (x,y,z) dimension.

How to find centroid or center of a 3D irregular shape

The centroid is defined as the arithmetic mean of the points, so just do that in each (x,y,z) dimension.

2 hours ago | 0

| accepted

Answered

I want to find code time delay

I have no idea what you are asking. If you want to find out how long it takes your code to run, use the tic (link) and toc fu...

I want to find code time delay

I have no idea what you are asking. If you want to find out how long it takes your code to run, use the tic (link) and toc fu...

6 hours ago | 0

Answered

How can I symbolically solve this system of equations?

Try this: syms B1 B2 g m1 m2 K1 K2 P v1(t) v2(t) x1(t) x2(t) x10 x20 v10 v20 Eq1 = diff(x1) == v1; Eq2 = diff(v1) == (1/m1)...

How can I symbolically solve this system of equations?

Try this: syms B1 B2 g m1 m2 K1 K2 P v1(t) v2(t) x1(t) x2(t) x10 x20 v10 v20 Eq1 = diff(x1) == v1; Eq2 = diff(v1) == (1/m1)...

6 hours ago | 0

Answered

Plotting multiple separate lines

Plot them as column vectors, not row vectors. Try this: A = [x1(:) y1(:)]; B = [x2(:) y2(:)]; I am not certain what result...

Plotting multiple separate lines

Plot them as column vectors, not row vectors. Try this: A = [x1(:) y1(:)]; B = [x2(:) y2(:)]; I am not certain what result...

8 hours ago | 0

| accepted

Answered

Output argument "Yeq" (and maybe others) not assigned during call Error Message

The easiest way to avoid that error is to assign all the outputs as NaN initially. The code will then replace them as necessary...

Output argument "Yeq" (and maybe others) not assigned during call Error Message

The easiest way to avoid that error is to assign all the outputs as NaN initially. The code will then replace them as necessary...

9 hours ago | 1

| accepted

Answered

How to create a manhattan function?

Considering that (from the mandist documentation): ‘The Manhattan distance D between two vectors X and Y is D = sum(abs(x-y))...

How to create a manhattan function?

Considering that (from the mandist documentation): ‘The Manhattan distance D between two vectors X and Y is D = sum(abs(x-y))...

19 hours ago | 0

Answered

Solving equation equal to zero with multivariables

Try this: Y= @(x) 29-(6*x(1))-(18*x(2)); yfcn = @(x2) Y([4000,x2]); X2 = fsolve(yfcn, 1000) producing: X2 = -1...

Solving equation equal to zero with multivariables

Try this: Y= @(x) 29-(6*x(1))-(18*x(2)); yfcn = @(x2) Y([4000,x2]); X2 = fsolve(yfcn, 1000) producing: X2 = -1...

20 hours ago | 0

Answered

Not enough input arguments error in ode23?

Most of what you are doing appears to be correct (I removed the clc and close calls): tspan=[1 4]; IC=[1;1;-1]; [t,y]=ode23(...

Not enough input arguments error in ode23?

Most of what you are doing appears to be correct (I removed the clc and close calls): tspan=[1 4]; IC=[1;1;-1]; [t,y]=ode23(...

1 day ago | 0

Answered

How to partial derive a matrix with multiple variables

If your matrix is symbolic, see if the jacobian (link) function will do what you want. The gradient (link) function is also an ...

How to partial derive a matrix with multiple variables

If your matrix is symbolic, see if the jacobian (link) function will do what you want. The gradient (link) function is also an ...

1 day ago | 0

Answered

How to iterate xa from 0 to 1 with steps of 0.05 in the function r=F*(k*C*(1-xa))/(1+K*C*(1-xa)). All variables are known except for r.

Everything except ‘x’ are scalars, so you can do this using a vectorization approach without the loop: F=0.11574; k_kin=1.3*10...

How to iterate xa from 0 to 1 with steps of 0.05 in the function r=F*(k*C*(1-xa))/(1+K*C*(1-xa)). All variables are known except for r.

Everything except ‘x’ are scalars, so you can do this using a vectorization approach without the loop: F=0.11574; k_kin=1.3*10...

1 day ago | 1

| accepted

Answered

How do i detect/describe a curvature from a data-set of coordinates

The polyfit function will not give you the centre and radius of your arc. This will: t = linspace(-pi/4, pi/4, 10); ...

How do i detect/describe a curvature from a data-set of coordinates

The polyfit function will not give you the centre and radius of your arc. This will: t = linspace(-pi/4, pi/4, 10); ...

1 day ago | 0

| accepted

Answered

Retrieving a random element from each row in a matrix

It is likely easier to use the sub2ind funciton to create linear indices into ‘R’ from a defined list of random column subscript...

Retrieving a random element from each row in a matrix

It is likely easier to use the sub2ind funciton to create linear indices into ‘R’ from a defined list of random column subscript...

1 day ago | 0

| accepted

Answered

for plot using 'yyaxis left' and 'yyaxis right' how to add separate legends for the two y axes

The legend is for all the data in the plot (or as many as you want to incllude in the legend call). The y-axis labels are diffe...

for plot using 'yyaxis left' and 'yyaxis right' how to add separate legends for the two y axes

The legend is for all the data in the plot (or as many as you want to incllude in the legend call). The y-axis labels are diffe...

1 day ago | 0

Answered

how to calculate absolute value for a tf-object for a certain frequency

Thje evalfr (link) function is likely what you want. It requires a complex radian frequency for the frequency argument, so fo...

how to calculate absolute value for a tf-object for a certain frequency

Thje evalfr (link) function is likely what you want. It requires a complex radian frequency for the frequency argument, so fo...

1 day ago | 0

Answered

How do I only get vectors out of the butter function?

Your filter design has other problems. Your actual sampling frequency is: Fs = 1/mean(diff(t)); or 10, and the Nyquist frequ...

How do I only get vectors out of the butter function?

Your filter design has other problems. Your actual sampling frequency is: Fs = 1/mean(diff(t)); or 10, and the Nyquist frequ...

1 day ago | 0

Answered

Joining every eight columns in a matrix

Here are a couple approaches: A = [1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8; randi(9,1,16); randi(9,1,16)]; % Augmented S = spr...

Joining every eight columns in a matrix

Here are a couple approaches: A = [1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8; randi(9,1,16); randi(9,1,16)]; % Augmented S = spr...

2 days ago | 0

Answered

How can I find a vector in a matrix without using cycles?

Try this: A = [1 2 3 4 5 3 3 1 6 4 4 2]; B = [4 6]; Lidx = ism...

How can I find a vector in a matrix without using cycles?

Try this: A = [1 2 3 4 5 3 3 1 6 4 4 2]; B = [4 6]; Lidx = ism...

2 days ago | 0

| accepted

Answered

Plotting trajectories of a system of equations.

First, use the matlabFunction (link) function to create anonymous functions (or function files) from your symbolic expressions. ...

Plotting trajectories of a system of equations.

First, use the matlabFunction (link) function to create anonymous functions (or function files) from your symbolic expressions. ...

2 days ago | 0

Answered

Hi, how can i extract the angle from (x,y) coordinates in degrees.

Your best option is likely the atan2d (link) function.

Hi, how can i extract the angle from (x,y) coordinates in degrees.

Your best option is likely the atan2d (link) function.

2 days ago | 0

Answered

Index Exceeds number of array elements (1)

I suspect your initial conditions vector in your ode solver call only has one element. It should be a 5-element vector. You ...

Index Exceeds number of array elements (1)

I suspect your initial conditions vector in your ode solver call only has one element. It should be a 5-element vector. You ...

3 days ago | 0

| accepted

Answered

How to apply a diff to histogram object?

I have no idea what you wwant. Try this: dH = diff(H.BinCounts); To se all the available fields, do this: histogramField...

How to apply a diff to histogram object?

I have no idea what you wwant. Try this: dH = diff(H.BinCounts); To se all the available fields, do this: histogramField...

3 days ago | 0

| accepted

Answered

exponential with fuction integrate

You need to remove ’exp’ and ‘j’ from your syms call: syms t k w T You want to use the function exp, and the imaginary operat...

exponential with fuction integrate

You need to remove ’exp’ and ‘j’ from your syms call: syms t k w T You want to use the function exp, and the imaginary operat...

3 days ago | 0

| accepted

Answered

subtracting a number from string

One approach: str = 'subject1_EO'; nrc = regexp(str, '\d+', 'match') nr = str2double(nrc{:}) producing: nrc = 1×1 cell...

subtracting a number from string

One approach: str = 'subject1_EO'; nrc = regexp(str, '\d+', 'match') nr = str2double(nrc{:}) producing: nrc = 1×1 cell...

3 days ago | 1

Answered

non linear equation, fminsearch, to find unknown parameters

I am not certain what you are doing. I altered your code slightly: xc = @(k,n,a) (k.^n.*((1515-T)./CR).^n+a)./(1+k.^n.*((15...

non linear equation, fminsearch, to find unknown parameters

I am not certain what you are doing. I altered your code slightly: xc = @(k,n,a) (k.^n.*((1515-T)./CR).^n+a)./(1+k.^n.*((15...

3 days ago | 0

Answered

Storing data for "for loop"

Try something like this: L0 = [1 2 3 4 5]; L10 = [2 3 4 5 6]; L20 = [0 9 2 3 4]; L = [L0; L10; L20]; x = 0:4; n = size(...

Storing data for "for loop"

Try something like this: L0 = [1 2 3 4 5]; L10 = [2 3 4 5 6]; L20 = [0 9 2 3 4]; L = [L0; L10; L20]; x = 0:4; n = size(...

4 days ago | 1

| accepted

Answered

how to plot symbolic equation

That requires a bit of name-value pair arguments to the fcontour function. Try this: syms f(x,y) x y f(x,y) = x^2 + (3*y...

how to plot symbolic equation

That requires a bit of name-value pair arguments to the fcontour function. Try this: syms f(x,y) x y f(x,y) = x^2 + (3*y...

4 days ago | 0

| accepted

Answered

Cant run this script, trying to plot a graph, please help

My pleasure. When I did: D1 = load('PC3_DMSO_0.5uM_4c.mat') I got: D1 = struct with fields: PC3_TOFA_5uM_8:...

Cant run this script, trying to plot a graph, please help

My pleasure. When I did: D1 = load('PC3_DMSO_0.5uM_4c.mat') I got: D1 = struct with fields: PC3_TOFA_5uM_8:...

4 days ago | 0

Answered

Simplifiy function incorrect result?

You just need to tell simplify to keep simplifying: DetJa = simplify(detJa, 'Steps',500) producing: DetJa = l3*l4*sin(q3)...

Simplifiy function incorrect result?

You just need to tell simplify to keep simplifying: DetJa = simplify(detJa, 'Steps',500) producing: DetJa = l3*l4*sin(q3)...

4 days ago | 0

| accepted