12,757 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

Read several large csv and store as separate variables

Perhaps saving it in a cell array would work: file{i}=readmatrix(filename); Note the curly brackets {} denoting cell-array i...

Read several large csv and store as separate variables

Perhaps saving it in a cell array would work: file{i}=readmatrix(filename); Note the curly brackets {} denoting cell-array i...

2 hours ago | 0

Answered

How to quickly find the maximum group of same rows in a matrix?

Try this: A = [0 1 0 1 0 0 0 0; 1 0 0 0 1 0 0 0; 1 0 0 0 ...

How to quickly find the maximum group of same rows in a matrix?

Try this: A = [0 1 0 1 0 0 0 0; 1 0 0 0 1 0 0 0; 1 0 0 0 ...

4 hours ago | 0

| accepted

Answered

Display Markers At Specific Data Points

The MarkerIndices name-value pair is relatively new. If you do not have it, it is straightforward to do that with a second plo...

Display Markers At Specific Data Points

The MarkerIndices name-value pair is relatively new. If you do not have it, it is straightforward to do that with a second plo...

4 hours ago | 1

| accepted

Answered

Units for Magnitude after Fast Fourier Transform (FFT) is done

The magnitude units are the same as the time-domain amplitude units, unless you transform them in some way (such as squaring to ...

Units for Magnitude after Fast Fourier Transform (FFT) is done

The magnitude units are the same as the time-domain amplitude units, unless you transform them in some way (such as squaring to ...

8 hours ago | 0

Answered

How to fill a vector with just 2 elements -1 and 1, as a pseudorandom sequence?

Try this: N = 10; xpnt = randi(2, 1, N); X = (-1).^xpnt; producing (in this run): X = -1 1 1 1 -1 ...

How to fill a vector with just 2 elements -1 and 1, as a pseudorandom sequence?

Try this: N = 10; xpnt = randi(2, 1, N); X = (-1).^xpnt; producing (in this run): X = -1 1 1 1 -1 ...

10 hours ago | 1

| accepted

Answered

design filter , Hello everyone, I'm trying to run a script I've written that deals with signal modulation and frequency filtering. unfortunately, the software is crashing at runtime while its deal with the "bode", what can i do?

The bode function is part of the Control System Toolbox (and friends). It takes a system object as an argument. Also, multiply...

design filter , Hello everyone, I'm trying to run a script I've written that deals with signal modulation and frequency filtering. unfortunately, the software is crashing at runtime while its deal with the "bode", what can i do?

The bode function is part of the Control System Toolbox (and friends). It takes a system object as an argument. Also, multiply...

11 hours ago | 0

| accepted

Answered

How to rearrange the output variables for matlabFunction()?

I can’t run the code you posted, since it generates significant errors about matrix size multiplication. However, a simple ex...

How to rearrange the output variables for matlabFunction()?

I can’t run the code you posted, since it generates significant errors about matrix size multiplication. However, a simple ex...

1 day ago | 1

| accepted

Answered

solve an equation using solve() produces an array instead of a unique value

The result is correct. There are three roots. Plot it to see the result: syms h d = 32*h + 200*(32*h - 8)*((4*h - 1)^2 -...

solve an equation using solve() produces an array instead of a unique value

The result is correct. There are three roots. Plot it to see the result: syms h d = 32*h + 200*(32*h - 8)*((4*h - 1)^2 -...

1 day ago | 0

| accepted

Answered

Error while solving a coupled system of ODE

Your ‘DM_bacteria’ function must return a column vector output. This worked when I ran it just now: function [dxdt] = DM_ba...

Error while solving a coupled system of ODE

Your ‘DM_bacteria’ function must return a column vector output. This worked when I ran it just now: function [dxdt] = DM_ba...

1 day ago | 1

Answered

Array indices must be positive integers or logical values

The problem: for k=0:M-1 The solution: for k=1:M In MATLAB, subscript indices begin at 1, not 0, and are defined as intege...

Array indices must be positive integers or logical values

The problem: for k=0:M-1 The solution: for k=1:M In MATLAB, subscript indices begin at 1, not 0, and are defined as intege...

1 day ago | 0

| accepted

Answered

Wrong answer for sine function

Define ‘t’ in terms of days (or fractions of days). Try this: rforce = @(t) 0.3 + 0.2.*sin(2.*pi.*t/365 - pi/2); tdays =...

Wrong answer for sine function

Define ‘t’ in terms of days (or fractions of days). Try this: rforce = @(t) 0.3 + 0.2.*sin(2.*pi.*t/365 - pi/2); tdays =...

1 day ago | 1

| accepted

Answered

Working With Matlab Tables

I created my own table to test my code. (I didn’t post it previously because the other two Answers had already appeared.) Th...

Working With Matlab Tables

I created my own table to test my code. (I didn’t post it previously because the other two Answers had already appeared.) Th...

1 day ago | 0

Answered

Ploting two different vectors in the same figure

Use element-wise multiplication, then transpose ‘a’ and ‘b’ to use the references in your plot3 calls. Alos, specifically use t...

Ploting two different vectors in the same figure

Use element-wise multiplication, then transpose ‘a’ and ‘b’ to use the references in your plot3 calls. Alos, specifically use t...

1 day ago | 0

| accepted

Answered

Understanding Figure Windows & Changing Their Apperances

According to the documentation on Figure Properties, Number is read-only. However, this appears to work: Stress = figure(34...

Understanding Figure Windows & Changing Their Apperances

According to the documentation on Figure Properties, Number is read-only. However, this appears to work: Stress = figure(34...

1 day ago | 0

Answered

plot with a few sample marked.

Try these: x= 1:0.01:40; y = cos(x); L1 = y <= 0.5; % Logical Index: y <= 0.5 figure pl...

plot with a few sample marked.

Try these: x= 1:0.01:40; y = cos(x); L1 = y <= 0.5; % Logical Index: y <= 0.5 figure pl...

1 day ago | 0

Answered

how can i save struct in file txt?

Use the save function to save it as a .mat file.

how can i save struct in file txt?

Use the save function to save it as a .mat file.

1 day ago | 1

| accepted

Answered

Circle centers plot aren't in the same place as the circles in a figure

I cannot run your code. However, since ‘centersStrong’ is a two-column matrix of the x and y coordinates, your plot call woul...

Circle centers plot aren't in the same place as the circles in a figure

I cannot run your code. However, since ‘centersStrong’ is a two-column matrix of the x and y coordinates, your plot call woul...

1 day ago | 0

| accepted

Answered

The question about DC component!

Removing the DC component is useful in showing the other peaks in the Fourier transform of your signal, if there is a very high ...

The question about DC component!

Removing the DC component is useful in showing the other peaks in the Fourier transform of your signal, if there is a very high ...

2 days ago | 0

| accepted

Answered

fprintf conversion character use \c or \s?

Putting character arrays and numeric variable types together in a matrix is not appropriate. Try this instead: countries = ...

fprintf conversion character use \c or \s?

Putting character arrays and numeric variable types together in a matrix is not appropriate. Try this instead: countries = ...

2 days ago | 0

Answered

Error when solving an equation involving a poisson pdf

Try this (instead of using the Symbolic Math Toolbox): lambda = fzero(@(lambda) poisspdf(10, lambda) - 0.1, 5) producing: l...

Error when solving an equation involving a poisson pdf

Try this (instead of using the Symbolic Math Toolbox): lambda = fzero(@(lambda) poisspdf(10, lambda) - 0.1, 5) producing: l...

2 days ago | 0

| accepted

Answered

Ploting solutions to linear equations

The ‘A*Y’ operation attempts to multiply (3x3) matrix ‘A’ by a (2x1) vector ‘Y’. That will just never work! The ‘Y’ vector m...

Ploting solutions to linear equations

The ‘A*Y’ operation attempts to multiply (3x3) matrix ‘A’ by a (2x1) vector ‘Y’. That will just never work! The ‘Y’ vector m...

2 days ago | 0

Answered

How to retrieve last 3 digits from each entry of a matrix of order 3 x 4 ?

Another approach: A = [35679, 35678, 35677, 35676; 35675, 35674, 35673, 35672; 35671, 35670, 35669, 35668]; Out = 1000*rem(A/...

How to retrieve last 3 digits from each entry of a matrix of order 3 x 4 ?

Another approach: A = [35679, 35678, 35677, 35676; 35675, 35674, 35673, 35672; 35671, 35670, 35669, 35668]; Out = 1000*rem(A/...

2 days ago | 0

Answered

Mean of 72720 rows in one column such that I can take mean of 720 rows separately.

Try this: data = (1:72720)'; % Create Column Vector To Test Code rdata = reshape(data, [], 7...

Mean of 72720 rows in one column such that I can take mean of 720 rows separately.

Try this: data = (1:72720)'; % Create Column Vector To Test Code rdata = reshape(data, [], 7...

2 days ago | 1

| accepted

Answered

insert rows and columns in a matrix

One approach: M = rand(3); Mz = zeros(size(M,1)+1, size(M,2)+1); Mz(1:size(M,1), 1:size(M,2)) = M; producing (here): Mz =...

insert rows and columns in a matrix

One approach: M = rand(3); Mz = zeros(size(M,1)+1, size(M,2)+1); Mz(1:size(M,1), 1:size(M,2)) = M; producing (here): Mz =...

2 days ago | 1

| accepted

Answered

Creating String Array Between Two Dates

Try this: date = '01-jan-2019'; EndDate = '03-feb-2019'; DateVec = datetime(date); EndDateVec = datetime(EndDate); DayArr ...

Creating String Array Between Two Dates

Try this: date = '01-jan-2019'; EndDate = '03-feb-2019'; DateVec = datetime(date); EndDateVec = datetime(EndDate); DayArr ...

2 days ago | 0

Answered

Function for ODE45 solver doesn't work

You have not provided enough information to determine what the problem is. However, considering that ‘Istim_sys’ may be a vecto...

Function for ODE45 solver doesn't work

You have not provided enough information to determine what the problem is. However, considering that ‘Istim_sys’ may be a vecto...

3 days ago | 0

Answered

Function doesn't return a vector from a vector input

‘Could someone tell me my mistake?’ You need to use the any or all functions in the if statements, depending on what you want...

Function doesn't return a vector from a vector input

‘Could someone tell me my mistake?’ You need to use the any or all functions in the if statements, depending on what you want...

3 days ago | 1

| accepted

Answered

Bode Plot - trasnfer function

Try this (your code slightly edited): s = tf('s'); G = ((1+s*1E-3))/((s*1E-2)*(1+s*1E-1)*(1+s*1E-5)); bode(G) ...

Bode Plot - trasnfer function

Try this (your code slightly edited): s = tf('s'); G = ((1+s*1E-3))/((s*1E-2)*(1+s*1E-1)*(1+s*1E-5)); bode(G) ...

3 days ago | 1

| accepted

Answered

Failure in initial objective function evaluation. FSOLVE cannot continue.

The ‘Y’ evaluation is missing a few multiplication(?) operators, and needs to do element-wise operations elsewhere: Y = B-((Q1...

Failure in initial objective function evaluation. FSOLVE cannot continue.

The ‘Y’ evaluation is missing a few multiplication(?) operators, and needs to do element-wise operations elsewhere: Y = B-((Q1...

3 days ago | 0