Answered

How to find values for corresponding elements

wanted_output = nan(length(time_vector),1); mask = islocalmax(Q); wanted_output(mask) = Q(mask);

How to find values for corresponding elements

wanted_output = nan(length(time_vector),1); mask = islocalmax(Q); wanted_output(mask) = Q(mask);

28 minuti ago | 0

Answered

How to open Matlab with specific scripts in my editor?

See https://www.mathworks.com/matlabcentral/answers/344124-restore-open-files-in-editor-from-previous-sessions https://www.mat...

How to open Matlab with specific scripts in my editor?

See https://www.mathworks.com/matlabcentral/answers/344124-restore-open-files-in-editor-from-previous-sessions https://www.mat...

circa un'ora ago | 0

Answered

How to use solve with a equation with limit

syms b1 c1 s a = 1; b = 7.598; c = 6.784; kp = limit(20.185/(a*s^2+b*b1*s+c),s,0) Notice this is constant, not dependent on...

How to use solve with a equation with limit

syms b1 c1 s a = 1; b = 7.598; c = 6.784; kp = limit(20.185/(a*s^2+b*b1*s+c),s,0) Notice this is constant, not dependent on...

circa 2 ore ago | 0

Answered

How to close graph help popup from command line?

Perhaps https://www.mathworks.com/help/matlab/ref/disabledefaultinteractivity.html See also https://www.mathworks.com/help/mat...

How to close graph help popup from command line?

Perhaps https://www.mathworks.com/help/matlab/ref/disabledefaultinteractivity.html See also https://www.mathworks.com/help/mat...

circa 2 ore ago | 0

Answered

Finding a variable between a a lot of m files

In the main MATLAB command window, look on the HOME tab, in the ribbon, 5th entry is "Find files". Click on there and you will b...

Finding a variable between a a lot of m files

In the main MATLAB command window, look on the HOME tab, in the ribbon, 5th entry is "Find files". Click on there and you will b...

circa 14 ore ago | 0

| accepted

Answered

matlabFunction: Index exceeds the number of array elements for Matlab R2021a

matlabFunction has a bug in writing any function using piecewise to a file in expression that is complicated enough that the fun...

matlabFunction: Index exceeds the number of array elements for Matlab R2021a

matlabFunction has a bug in writing any function using piecewise to a file in expression that is complicated enough that the fun...

circa 17 ore ago | 0

| accepted

Answered

How to define a binary decision variable as upper and lower bond in an optimization function?

https://www.mathworks.com/help/gads/particle-swarm-optimization-algorithm.html You cannot use integer constraints with the Mat...

How to define a binary decision variable as upper and lower bond in an optimization function?

https://www.mathworks.com/help/gads/particle-swarm-optimization-algorithm.html You cannot use integer constraints with the Mat...

circa 20 ore ago | 1

Answered

Problem with matlabFunction throwing error in latest MATLAB version

There is a bug in matlabFunction in R2021a, in a section of code that did not exist at all before (and had no analog at all befo...

Problem with matlabFunction throwing error in latest MATLAB version

There is a bug in matlabFunction in R2021a, in a section of code that did not exist at all before (and had no analog at all befo...

circa 22 ore ago | 0

Answered

MATLAB write a function that generates n x n matrix WITHOUT built in functions.

Your S is symmetric. However, your code uses the undefined variable A B = A' + A; B(1:n+1:end)=diag(A); %This part is suppos...

MATLAB write a function that generates n x n matrix WITHOUT built in functions.

Your S is symmetric. However, your code uses the undefined variable A B = A' + A; B(1:n+1:end)=diag(A); %This part is suppos...

1 giorno ago | 1

Answered

fprintf returns blank square for value of 1?

You are trying to use a %s (string) format to display floating point data. Use a %f or %g format instead. DRAT = [72 105] fpri...

fprintf returns blank square for value of 1?

You are trying to use a %s (string) format to display floating point data. Use a %f or %g format instead. DRAT = [72 105] fpri...

1 giorno ago | 0

| accepted

Answered

how to make nxn matrix

n = 7 d = ones(1,n-2)/2; M = zeros(n,n) + diag([0,d],+1) + diag([d,0],-1); M(1) = 1; M(end) = 1; M

how to make nxn matrix

n = 7 d = ones(1,n-2)/2; M = zeros(n,n) + diag([0,d],+1) + diag([d,0],-1); M(1) = 1; M(end) = 1; M

1 giorno ago | 1

| accepted

Answered

Need to find the smallest [n] such that the sum for a harmonic series is greater than some value X.

n = 25000; %max number of rows that will print S = 0; %initial starting value of sum for i...

Need to find the smallest [n] such that the sum for a harmonic series is greater than some value X.

n = 25000; %max number of rows that will print S = 0; %initial starting value of sum for i...

1 giorno ago | 1

| accepted

Answered

Correction of misspelled words in data source

If you are dealing with a text file, I would suggest rewriting in terms of regexp() with named tokens S = sprintf('Signal1: 5,...

Correction of misspelled words in data source

If you are dealing with a text file, I would suggest rewriting in terms of regexp() with named tokens S = sprintf('Signal1: 5,...

1 giorno ago | 0

Answered

Error using load Unable to read file 'iris'. No such file or directory.

When you do not give a file extension when you load(), then the only one MATLAB will search for is .mat . Your file is a .data f...

Error using load Unable to read file 'iris'. No such file or directory.

When you do not give a file extension when you load(), then the only one MATLAB will search for is .mat . Your file is a .data f...

1 giorno ago | 0

Answered

How to save a txt file in matlab with the specified name I want?

fullname = fullfile('directory path', [filename '.txt']); save(fullname, 'A', '-ascii')

How to save a txt file in matlab with the specified name I want?

fullname = fullfile('directory path', [filename '.txt']); save(fullname, 'A', '-ascii')

1 giorno ago | 1

| accepted

Answered

Using Matlab for solving symbolic equations

you have 11 equations in about 17 variables, and you ask to solve the equations in terms of one of the variables. When you are u...

Using Matlab for solving symbolic equations

you have 11 equations in about 17 variables, and you ask to solve the equations in terms of one of the variables. When you are u...

1 giorno ago | 0

Answered

Error using odearguments (line 113) Inputs must be floats, namely single or double.

You need to use matlabFunction() to turn your symbolic expressions into numeric code. Be sure to use the 'vars' option to contro...

Error using odearguments (line 113) Inputs must be floats, namely single or double.

You need to use matlabFunction() to turn your symbolic expressions into numeric code. Be sure to use the 'vars' option to contro...

1 giorno ago | 0

Answered

Does not properly read csv file

readcell() instead of readtable(). Your file mixes data types.

Does not properly read csv file

readcell() instead of readtable(). Your file mixes data types.

1 giorno ago | 0

| accepted

Answered

Galois field to binary matrix conversion (BCH encoding)

NC = noisycode.x; That will be uint32 with min 0 and max 0, so you can logical() it or double() it or uint8() it as appropriate...

Galois field to binary matrix conversion (BCH encoding)

NC = noisycode.x; That will be uint32 with min 0 and max 0, so you can logical() it or double() it or uint8() it as appropriate...

1 giorno ago | 0

Answered

How to add constraints to simulannealbnd minimization

You cannot add constraints directly. However you can set AnnealingFcn to the handle of a function that only generates points tha...

How to add constraints to simulannealbnd minimization

You cannot add constraints directly. However you can set AnnealingFcn to the handle of a function that only generates points tha...

1 giorno ago | 1

Answered

Plotting a non linear equation.

format long g t_min = .3, t_max = .8 syms theta_opt m real a = sin(theta_opt).^2; b = (cos(theta_opt) - sin(theta_opt)...

Plotting a non linear equation.

format long g t_min = .3, t_max = .8 syms theta_opt m real a = sin(theta_opt).^2; b = (cos(theta_opt) - sin(theta_opt)...

1 giorno ago | 1

| accepted

Answered

Input #2 expected to be a cell array, was struct instead.

You need arrayfun() instead of cellfun() for that purpose. This assumes that in time Code2Model will be a non-scalar struct ar...

Input #2 expected to be a cell array, was struct instead.

You need arrayfun() instead of cellfun() for that purpose. This assumes that in time Code2Model will be a non-scalar struct ar...

1 giorno ago | 0

Answered

How to get all possible combinations of three independent data sets?

A = [A_x A_y]; B = [B_x B_y]; C = [C_x C_y]; ABC = [A;B;C]; D= [D_x D_y]; E = [E_x E_y]; F = [F_x F_y]; DEF = [D;E;F]...

How to get all possible combinations of three independent data sets?

A = [A_x A_y]; B = [B_x B_y]; C = [C_x C_y]; ABC = [A;B;C]; D= [D_x D_y]; E = [E_x E_y]; F = [F_x F_y]; DEF = [D;E;F]...

1 giorno ago | 2

| accepted

Answered

guesses of parameters in fmincon do not satisfy the constraints in nonlcon

Solvers can violate bounds constraints with some options: https://www.mathworks.com/help/optim/ug/iterations-can-violate-constr...

guesses of parameters in fmincon do not satisfy the constraints in nonlcon

Solvers can violate bounds constraints with some options: https://www.mathworks.com/help/optim/ug/iterations-can-violate-constr...

1 giorno ago | 0

Answered

Find the index range of ones/trues?

test_vector = [0,0,1,0,0,1,1,0,1,1,1,0,1,1,1,1]; starts = strfind([0 test_vector], [0 1]); stops = strfind([test_vector 0], [1...

Find the index range of ones/trues?

test_vector = [0,0,1,0,0,1,1,0,1,1,1,0,1,1,1,1]; starts = strfind([0 test_vector], [0 1]); stops = strfind([test_vector 0], [1...

1 giorno ago | 0

| accepted

Answered

Improving speed of readtable

Where all of the time is spent on the TreatAsEmpty command (because of having many zero entries?) No, that is not what is happe...

Improving speed of readtable

Where all of the time is spent on the TreatAsEmpty command (because of having many zero entries?) No, that is not what is happe...

1 giorno ago | 0

| accepted

Answered

Device number can that used with one license

Home and Student licenses: one device only (Individual) Academic licenses: two devices activated (Individual) Standard (Commer...

Device number can that used with one license

Home and Student licenses: one device only (Individual) Academic licenses: two devices activated (Individual) Standard (Commer...

2 giorni ago | 0

| accepted

Answered

Fzero function error in matlab

x = fzero(@(x) (707.34/(x-x^2)*(1+0.1*(10.589*(1-x)/x).^0.75)-(x-x^2)*9778.608 , 0.2) 1 2 1 2 3 2 3 4 ...

Fzero function error in matlab

x = fzero(@(x) (707.34/(x-x^2)*(1+0.1*(10.589*(1-x)/x).^0.75)-(x-x^2)*9778.608 , 0.2) 1 2 1 2 3 2 3 4 ...

2 giorni ago | 0

Answered

How do I find unknown parameter from an equation?

eqn = @(c) z - a.*b./(c.*d); c = fsolve(eqn, GUESS) This assumes that the equation is complex enough that you cannot just me...

How do I find unknown parameter from an equation?

eqn = @(c) z - a.*b./(c.*d); c = fsolve(eqn, GUESS) This assumes that the equation is complex enough that you cannot just me...

3 giorni ago | 0

| accepted