It is easier to solve a problem than to guess, what the problem is.

Questions about FileExchange submissions are welcome - get my address from the code. I do not answer mails concerning questions in the forum.

Answered

why didn't the event function detect the events?

Just my standard interjection: Matlab's ODE integrators are designed to integrate smooth functions. Your function Tq_Tj() conati...

why didn't the event function detect the events?

Just my standard interjection: Matlab's ODE integrators are designed to integrate smooth functions. Your function Tq_Tj() conati...

alrededor de 23 horas ago | 0

Answered

Low pass filter VS high pass filter

On first view you see, thet the high frequencies are removed: the changes between neighboring values are reduced. This means tha...

Low pass filter VS high pass filter

On first view you see, thet the high frequencies are removed: the changes between neighboring values are reduced. This means tha...

alrededor de 23 horas ago | 1

Answered

Maximum number of repeated values over an array

With FileExchange: RunLength : a = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0, ... 5,0,0,0,0,0,0,0,0,0,0,0,...

Maximum number of repeated values over an array

With FileExchange: RunLength : a = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0, ... 5,0,0,0,0,0,0,0,0,0,0,0,...

2 días ago | 0

Answered

How can i count how many time a number appears and for how long in a vector?

Start with a run-length-encoding, e.g. by FileExchange: RunLength . If you do not have a C-Compiler installed, use RunLength_M o...

How can i count how many time a number appears and for how long in a vector?

Start with a run-length-encoding, e.g. by FileExchange: RunLength . If you do not have a C-Compiler installed, use RunLength_M o...

2 días ago | 0

| accepted

Answered

Assembling two matrices into one in a given pattern

A bold guess (although a wrong guess might be more confusing than posting nothing): A = [1 2; 1 2]; B = [2 3; 2 3]; [s1, s2...

Assembling two matrices into one in a given pattern

A bold guess (although a wrong guess might be more confusing than posting nothing): A = [1 2; 1 2]; B = [2 3; 2 3]; [s1, s2...

2 días ago | 0

Answered

Array indices must be positive integers or logical values.

What is z1 and z2? Are these vectors? Then the message means, that z2((x(a)-x0)^2/z2^2+1) is not a valid expression, because ...

Array indices must be positive integers or logical values.

What is z1 and z2? Are these vectors? Then the message means, that z2((x(a)-x0)^2/z2^2+1) is not a valid expression, because ...

4 días ago | 1

Answered

2D Interpolation with different sized matrices

A bold guess of what "corresponding x value when the y and z values are provided" means: x = [1 2 3 4 5]; y = [1 2 3 4 5]; z ...

2D Interpolation with different sized matrices

A bold guess of what "corresponding x value when the y and z values are provided" means: x = [1 2 3 4 5]; y = [1 2 3 4 5]; z ...

4 días ago | 0

Answered

How to append for each iteration?

hournum = 10; projectlength = 3; yield = cell(1, projectlength); % Pre-allocate as cell helper = zeros(1, hournum); % P...

How to append for each iteration?

hournum = 10; projectlength = 3; yield = cell(1, projectlength); % Pre-allocate as cell helper = zeros(1, hournum); % P...

4 días ago | 0

| accepted

Answered

Functions in If Statements

This: for n = 1:FMn %cycle through files in the directory finalname = FMdir(n).name; end does the same as: finalname = ...

Functions in If Statements

This: for n = 1:FMn %cycle through files in the directory finalname = FMdir(n).name; end does the same as: finalname = ...

6 días ago | 0

Answered

How to code sparse diagonal matrix of increasing dimensions

Maybe this is not, what you want: for n = 500:50:1000 tic t1(n) = toc; end Setting t(500) in the 1st step ist not u...

How to code sparse diagonal matrix of increasing dimensions

Maybe this is not, what you want: for n = 500:50:1000 tic t1(n) = toc; end Setting t(500) in the 1st step ist not u...

6 días ago | 0

Answered

line and column of the minimun element of a matrix

m = [5 1 -400; ... -6 100 -6; 2 5 25]; [~, ind] = min(m(:)); [row, col] = ind2sub(size(m), ind) Or: [v, ind1]...

line and column of the minimun element of a matrix

m = [5 1 -400; ... -6 100 -6; 2 5 25]; [~, ind] = min(m(:)); [row, col] = ind2sub(size(m), ind) Or: [v, ind1]...

6 días ago | 1

| accepted

Answered

Problem with changing visibility of pop-up list

What is the purpose of: % Update handles structure guidata(hObject, handles); For some unknown reasons the value ...

Problem with changing visibility of pop-up list

What is the purpose of: % Update handles structure guidata(hObject, handles); For some unknown reasons the value ...

6 días ago | 0

Answered

-If else- conditionals in matlab app.designer?

if strcmp(app.menu.Value, 'ac') && ... or define the values as string with double quotes, not as "cell string", which...

-If else- conditionals in matlab app.designer?

if strcmp(app.menu.Value, 'ac') && ... or define the values as string with double quotes, not as "cell string", which...

6 días ago | 0

Answered

Min and max value of many results

Use a vectorized method to obtain the results as a vector, not as a bunch of single variables: w = 0:0.001:1.393; k = 2; ...

Min and max value of many results

Use a vectorized method to obtain the results as a vector, not as a bunch of single variables: w = 0:0.001:1.393; k = 2; ...

9 días ago | 2

Answered

Unrolling a 20x20 grid of pixels into a 400 dimensional vector.

If the data are a collection of 500 matrices of the size 20x20: data = rand(5000, 20, 20) You can create the 2D matrix by: da...

Unrolling a 20x20 grid of pixels into a 400 dimensional vector.

If the data are a collection of 500 matrices of the size 20x20: data = rand(5000, 20, 20) You can create the 2D matrix by: da...

10 días ago | 0

Answered

what is the probleme exactly u must be of size[3,20] but i find it [3,1]

Let me guess boldly: You want: A = [5/8, -1/4, 1/8; 1/4, 0, 1/4; 1/8, -1/4, 5/8]; b = [1;-1;1]; u = [5; 2; -4]; m = 20; u =...

what is the probleme exactly u must be of size[3,20] but i find it [3,1]

Let me guess boldly: You want: A = [5/8, -1/4, 1/8; 1/4, 0, 1/4; 1/8, -1/4, 5/8]; b = [1;-1;1]; u = [5; 2; -4]; m = 20; u =...

10 días ago | 0

Answered

Vector ODE using forward Euler method

You have replaced the "x" of the formula by "y(1)", the "y" by "y(2)". Now you have to replace "u" by "y(3)" also and "v" by "y(...

Vector ODE using forward Euler method

You have replaced the "x" of the formula by "y(1)", the "y" by "y(2)". Now you have to replace "u" by "y(3)" also and "v" by "y(...

12 días ago | 2

Answered

how to convert grey image to RGB

Your Pi is a [130 x 130 x 60] matrix, but your function gray2rgb() expects a 2D matrix as input. It is not clear how you want to...

how to convert grey image to RGB

Your Pi is a [130 x 130 x 60] matrix, but your function gray2rgb() expects a 2D matrix as input. It is not clear how you want to...

13 días ago | 0

Answered

imread reads PNG files as empty arrays

When I run your code in Matlab 2018b I get a different result: img = imread('18_1b.png'); size(img) % 500 x 500 x 3, not...

imread reads PNG files as empty arrays

When I run your code in Matlab 2018b I get a different result: img = imread('18_1b.png'); size(img) % 500 x 500 x 3, not...

13 días ago | 0

Answered

Increment components of vector till a desired limit

You know in advance how many iterations are needed: The smallest element must be increased until it is 100. A = [1 2 3 4 5...

Increment components of vector till a desired limit

You know in advance how many iterations are needed: The smallest element must be increased until it is 100. A = [1 2 3 4 5...

13 días ago | 1

| accepted

Answered

Making sure the maximum calculated value in my function is represented in ode15s output.

ODE15S is designed to integrate smooth functions, as the other ODE integrators of MATLAB are. Running it with this not different...

Making sure the maximum calculated value in my function is represented in ode15s output.

ODE15S is designed to integrate smooth functions, as the other ODE integrators of MATLAB are. Running it with this not different...

13 días ago | 1

| accepted

Answered

Derivative without diff function

"Not enough input arguments. Error in @(x,t)x/t" You have defined fun to use 2 input arguments: fun = @(y,t) y/t; But in fun...

Derivative without diff function

"Not enough input arguments. Error in @(x,t)x/t" You have defined fun to use 2 input arguments: fun = @(y,t) y/t; But in fun...

14 días ago | 0

Answered

Get all unique combinations from cell array for use as functional arguments

This can be achieved by 2 loops using linear indexing: for i1 = 1:numel(data) for i2 = 1:numel(data) immse(data{i...

Get all unique combinations from cell array for use as functional arguments

This can be achieved by 2 loops using linear indexing: for i1 = 1:numel(data) for i2 = 1:numel(data) immse(data{i...

14 días ago | 0

Answered

Combining cell arrays with empty doubles

Or simpler: a = {1, []}; b = {[], 2}; c = cat(2, a, b); c = c(~cellfun('isempty', c)); % Or: fullCell = @(x) x(~cellfu...

Combining cell arrays with empty doubles

Or simpler: a = {1, []}; b = {[], 2}; c = cat(2, a, b); c = c(~cellfun('isempty', c)); % Or: fullCell = @(x) x(~cellfu...

14 días ago | 0

Answered

Why I get this message?

Use the debugger to check the sizes of the arrays: dbstop if error Type this in the command line and run the code again. When ...

Why I get this message?

Use the debugger to check the sizes of the arrays: dbstop if error Type this in the command line and run the code again. When ...

14 días ago | 0

Answered

Appending to a very large file

This line increases the problem: signal_mat = vertcat(signal_mat,temp_2); In e.g. the last step, you concatenate a 63 GB array...

Appending to a very large file

This line increases the problem: signal_mat = vertcat(signal_mat,temp_2); In e.g. the last step, you concatenate a 63 GB array...

15 días ago | 0

Answered

How would I convert a script to a function?

All you have to do to convert it to a function, is to add a head line: function array = randArrGen Maybe you want to define n ...

How would I convert a script to a function?

All you have to do to convert it to a function, is to add a head line: function array = randArrGen Maybe you want to define n ...

15 días ago | 0

Answered

check for keyboard press while using another application (such as Chrome)

The key should be caught, while the browser is the active window? This is a keyboard sniffer and running it might be conflict wi...

check for keyboard press while using another application (such as Chrome)

The key should be caught, while the browser is the active window? This is a keyboard sniffer and running it might be conflict wi...

15 días ago | 0

Answered

Keeping the debugger out of the bowels of the machine...dbstop error question

This can be avoided by an exhaustive error checking, which catchs all not matching inputs as early as possible. Massive TRY-CATC...

Keeping the debugger out of the bowels of the machine...dbstop error question

This can be avoided by an exhaustive error checking, which catchs all not matching inputs as early as possible. Massive TRY-CATC...

15 días ago | 0

| accepted

Answered

How to return values of differential, not the function, from odefun, ode45?

You want the values of dy2dt? But you do have the equation for it already: dy2dt = (param.m2*y4^2*y1-param.k*y1+param.k*param.l...

How to return values of differential, not the function, from odefun, ode45?

You want the values of dy2dt? But you do have the equation for it already: dy2dt = (param.m2*y4^2*y1-param.k*y1+param.k*param.l...

15 días ago | 0