Answered

Attempt to execute SCRIPT ... as a function:

What do you mean by '10' on this line testfunktion(10) To call a script, you just need to type the script name testfunktion ...

Attempt to execute SCRIPT ... as a function:

What do you mean by '10' on this line testfunktion(10) To call a script, you just need to type the script name testfunktion ...

4 días ago | 1

Answered

Transfer function, G

's' is not defined by default in MATLAB. You need Control system toolbox to create a transfer function. Change the last part of ...

Transfer function, G

's' is not defined by default in MATLAB. You need Control system toolbox to create a transfer function. Change the last part of ...

4 días ago | 0

| accepted

Answered

Plotting a vector field

In slice command, you need to specify the locations on x, y and z axis at which you want to plot the plane. For example M; % 44...

Plotting a vector field

In slice command, you need to specify the locations on x, y and z axis at which you want to plot the plane. For example M; % 44...

4 días ago | 0

| accepted

Answered

create multiple separate vectors from a For loop

You current approach is optimal. Creating seperate variables like dice1, dice2, .. is not a good coding approach: https://www.ma...

create multiple separate vectors from a For loop

You current approach is optimal. Creating seperate variables like dice1, dice2, .. is not a good coding approach: https://www.ma...

4 días ago | 0

Answered

Call values from the struct file

You can access it like this [~,idx] = max([props.Area]); props(idx).BoundingBox(4)

Call values from the struct file

You can access it like this [~,idx] = max([props.Area]); props(idx).BoundingBox(4)

4 días ago | 0

| accepted

Answered

How to use filloutliers for only positive numbers of a data array?

Try this a = [ 2 1 23 -1 2 5 -36 6 -1] a(a>0) = filloutliers(a(a>0),'Linear')

How to use filloutliers for only positive numbers of a data array?

Try this a = [ 2 1 23 -1 2 5 -36 6 -1] a(a>0) = filloutliers(a(a>0),'Linear')

4 días ago | 0

| accepted

Answered

Changing order of legend entries

You can change the order, but for that you need the handle for each line. For example, plot two lines p1 = plot(rand(1,10)); p...

Changing order of legend entries

You can change the order, but for that you need the handle for each line. For example, plot two lines p1 = plot(rand(1,10)); p...

4 días ago | 0

Answered

Initialize MATLAB-Function

This is not really an error. It just tells that you need to change the sampling rate of this block from continuous to discrete. ...

Initialize MATLAB-Function

This is not really an error. It just tells that you need to change the sampling rate of this block from continuous to discrete. ...

5 días ago | 0

| accepted

Answered

matrices A, B, and C.

Since this is a homework problem, I won't give answers. Following links will be helpful https://www.mathworks.com/company/newsl...

matrices A, B, and C.

Since this is a homework problem, I won't give answers. Following links will be helpful https://www.mathworks.com/company/newsl...

5 días ago | 1

Answered

fminsearch with matrices help

x and y should be 3x150 to match the dimensions of matrix A. Following shows the correct code with fminsearch x = rand(3, 150);...

fminsearch with matrices help

x and y should be 3x150 to match the dimensions of matrix A. Following shows the correct code with fminsearch x = rand(3, 150);...

5 días ago | 0

Answered

how can I groups binary digits in array element

Try this combination of sprintf and sscanf. A = [11 1 1 1 1 1 1 1 0 1 0 1 0 1 0]; B = sscanf(sprintf('%d', A), '%4d'); Result...

how can I groups binary digits in array element

Try this combination of sprintf and sscanf. A = [11 1 1 1 1 1 1 1 0 1 0 1 0 1 0]; B = sscanf(sprintf('%d', A), '%4d'); Result...

5 días ago | 0

| accepted

Answered

How to define recursively symbolic function for differential equation system

This depends on what your ODE is. For example consider this ode each different value of 'a' create a different ODE. Now consi...

How to define recursively symbolic function for differential equation system

This depends on what your ODE is. For example consider this ode each different value of 'a' create a different ODE. Now consi...

5 días ago | 0

Answered

How to set randomization numbers ?

You can give a constant seed at beginning of your code rng(0); % replace 0 with anything A=randn(1,2); B=randn(1,3);

How to set randomization numbers ?

You can give a constant seed at beginning of your code rng(0); % replace 0 with anything A=randn(1,2); B=randn(1,3);

5 días ago | 0

| accepted

Answered

Add Variables to workspace from a struct

It is not a good coding practice to create a variable name like S1, S2, ... https://www.mathworks.com/matlabcentral/answers/3045...

Add Variables to workspace from a struct

It is not a good coding practice to create a variable name like S1, S2, ... https://www.mathworks.com/matlabcentral/answers/3045...

5 días ago | 0

| accepted

Answered

Indexing animated lines from array

When you initialize an array of MATLAB graphics objects like this num_plots = 2; g(1:num_plots) = animatedline; MATLAB create...

Indexing animated lines from array

When you initialize an array of MATLAB graphics objects like this num_plots = 2; g(1:num_plots) = animatedline; MATLAB create...

5 días ago | 0

| accepted

Answered

How do I create a for loop for averages?

No need to use for-loop averages = mean(RCP26(:,2:13), 2) See the dim argument to mean() function: https://www.mathworks.com/h...

How do I create a for loop for averages?

No need to use for-loop averages = mean(RCP26(:,2:13), 2) See the dim argument to mean() function: https://www.mathworks.com/h...

6 días ago | 1

| accepted

Answered

From XY array data in pixels to BW image

A little mistake in the calculation of idx idx = sub2ind([20 20],A(:,2),A(:,1)); % Last input shoule be A(:,1) Rest is correc...

From XY array data in pixels to BW image

A little mistake in the calculation of idx idx = sub2ind([20 20],A(:,2),A(:,1)); % Last input shoule be A(:,1) Rest is correc...

6 días ago | 1

| accepted

Answered

How do I select a window of pixels around a pixel?

See conv2(): https://www.mathworks.com/help/matlab/ref/conv2.html or imfilter(): https://www.mathworks.com/help/images/ref/imfi...

How do I select a window of pixels around a pixel?

See conv2(): https://www.mathworks.com/help/matlab/ref/conv2.html or imfilter(): https://www.mathworks.com/help/images/ref/imfi...

6 días ago | 0

Answered

how to count the number of a specific value in a cell array and how to access the index of each value

If possible, use numeric array for this type of data. They will be much more efficient and easy to deal with. For cell array, yo...

how to count the number of a specific value in a cell array and how to access the index of each value

If possible, use numeric array for this type of data. They will be much more efficient and easy to deal with. For cell array, yo...

6 días ago | 0

Answered

Solve as Optimization Problem in Matlab

MATLAB have genetic algorithm ga() from the global optimization toolbox to solve such problems f = @(x) 121 - 15*x(1) - 16*x(2)...

Solve as Optimization Problem in Matlab

MATLAB have genetic algorithm ga() from the global optimization toolbox to solve such problems f = @(x) 121 - 15*x(1) - 16*x(2)...

6 días ago | 1

| accepted

Answered

Difference between fprintf(fid, [str, 13 10]) and fprintf(fid, [str, '\n']) ?

ASCII 13 is carriage return character. It can be combined with newline (ASCII 10) to move to beginning of next line. Following l...

Difference between fprintf(fid, [str, 13 10]) and fprintf(fid, [str, '\n']) ?

ASCII 13 is carriage return character. It can be combined with newline (ASCII 10) to move to beginning of next line. Following l...

6 días ago | 1

| accepted

Answered

Heatmap title - Interpreter (AppDesigner)

It still does not support Interpreter. The workaround is to escape the underscore character h1.Title = strrep(file, '_', '\_')

Heatmap title - Interpreter (AppDesigner)

It still does not support Interpreter. The workaround is to escape the underscore character h1.Title = strrep(file, '_', '\_')

6 días ago | 0

| accepted

Answered

Size input must be scalar using rand to generate uniformly distributed numbers

rand() does not accept the range of random values. It always generates values between 0 and 1. You need to rescale yourself. lb...

Size input must be scalar using rand to generate uniformly distributed numbers

rand() does not accept the range of random values. It always generates values between 0 and 1. You need to rescale yourself. lb...

6 días ago | 0

| accepted

Answered

Negative Numbers to the power of 0

You can do it without for-loop k = 0:4; x = [-2.0 3.0 9.0 2.0 25.0]; A = x.^(k.') Also, x(col)^k(row) is equivalent to (-2...

Negative Numbers to the power of 0

You can do it without for-loop k = 0:4; x = [-2.0 3.0 9.0 2.0 25.0]; A = x.^(k.') Also, x(col)^k(row) is equivalent to (-2...

6 días ago | 0

| accepted

Answered

Unknown Parameter in Transfer Function

You can write the time-domain equation of this transfer function and then implement it using elementary blocks. Then you can var...

Unknown Parameter in Transfer Function

You can write the time-domain equation of this transfer function and then implement it using elementary blocks. Then you can var...

6 días ago | 1

Answered

Can my pc run Matlab

Your system meets the minimum requirements: https://www.mathworks.com/support/requirements/matlab-system-requirements.html so it...

Can my pc run Matlab

Your system meets the minimum requirements: https://www.mathworks.com/support/requirements/matlab-system-requirements.html so it...

6 días ago | 1

Answered

Cluster pixels in Binary Image from 2D-Histogram Data

You can use regionprops(): https://www.mathworks.com/help/images/ref/regionprops.html to get each white region in your image. Th...

Cluster pixels in Binary Image from 2D-Histogram Data

You can use regionprops(): https://www.mathworks.com/help/images/ref/regionprops.html to get each white region in your image. Th...

6 días ago | 0

Answered

How can I solve a problem related to the output argument.

The name of output argument does not matte outside the function. If you just want to output two values for each case, just use ...

How can I solve a problem related to the output argument.

The name of output argument does not matte outside the function. If you just want to output two values for each case, just use ...

6 días ago | 0

| accepted

Answered

How to resolve the error of "Consider preallocating for speed" which is coming on executing the program below??

My answer here: https://www.mathworks.com/matlabcentral/answers/614903-for-loop-preallocation-warning on a similar question can ...

How to resolve the error of "Consider preallocating for speed" which is coming on executing the program below??

My answer here: https://www.mathworks.com/matlabcentral/answers/614903-for-loop-preallocation-warning on a similar question can ...

6 días ago | 0

Answered

Matrix multiplication from the right with inverse matrix

You can use mrdivide / u = r/a The equation is equivalent to . mrdivide is used for such equations.

Matrix multiplication from the right with inverse matrix

You can use mrdivide / u = r/a The equation is equivalent to . mrdivide is used for such equations.

6 días ago | 0