Answered

solve vs. fsolve

Sometimes plotting and finding intervals by eye is not productive. In the general case, theory says that it is impossible to c...

solve vs. fsolve

Sometimes plotting and finding intervals by eye is not productive. In the general case, theory says that it is impossible to c...

6 days ago | 0

Answered

Make matrix with loop

In the general case: xvals = [list of x values, does not have to be regularly spaced or even sorted]; numx = length(xvals); y...

Make matrix with loop

In the general case: xvals = [list of x values, does not have to be regularly spaced or even sorted]; numx = length(xvals); y...

6 days ago | 0

Answered

Plot Not showing all values

The max value of col2 is only about 20, but the maximum value of col1 is 992008 Near 210 the entries go like 21.4239 21.5239 ...

Plot Not showing all values

The max value of col2 is only about 20, but the maximum value of col1 is 992008 Near 210 the entries go like 21.4239 21.5239 ...

6 days ago | 0

Answered

Multi Threads operation SERIAL PORT in Parallel

That cannot be done with asynchronous serial ports such as RS232 and USB. In order to synchronize reception of data, you need to...

Multi Threads operation SERIAL PORT in Parallel

That cannot be done with asynchronous serial ports such as RS232 and USB. In order to synchronize reception of data, you need to...

6 days ago | 0

Answered

how to insert value of array to other array

horzcat(). [list of values] is also horzcat()

how to insert value of array to other array

horzcat(). [list of values] is also horzcat()

6 days ago | 0

| accepted

Answered

What am I missing in this code I am trying to find roots of a System of Equation?

x=x+transpose(eps) That should be subtraction rather than addition.

What am I missing in this code I am trying to find roots of a System of Equation?

x=x+transpose(eps) That should be subtraction rather than addition.

6 days ago | 1

| accepted

Answered

Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.

inv(j)*f is going to return a column vector. Your original X0 is a row vector. Since R2016b, if you subtract a row vector and a ...

Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.

inv(j)*f is going to return a column vector. Your original X0 is a row vector. Since R2016b, if you subtract a row vector and a ...

6 days ago | 1

Answered

Function that calls another function in LiveScript

Yes, provided that you are using a MATLAB release new enough to support functions in Live Scripts (which you are.) Note that th...

Function that calls another function in LiveScript

Yes, provided that you are using a MATLAB release new enough to support functions in Live Scripts (which you are.) Note that th...

6 days ago | 0

| accepted

Answered

cumulatives of the dynamical system

You currently have a first order differential equation, diff(D,t) == x(t). When you use it with ode45 you would be using a funct...

cumulatives of the dynamical system

You currently have a first order differential equation, diff(D,t) == x(t). When you use it with ode45 you would be using a funct...

6 days ago | 0

| accepted

Answered

Efficiently ways to solve for multiple for loops, of which the indices are the parameters of a function

You can do at least part of it in vectorized form. The following deliberately creates random numbers in the same order as if yo...

Efficiently ways to solve for multiple for loops, of which the indices are the parameters of a function

You can do at least part of it in vectorized form. The following deliberately creates random numbers in the same order as if yo...

7 days ago | 0

Answered

How do I define an empty table of unknown size?

Sorry, variables that do not exist do not have any datatype. As you add variables to the table, the datatype associated with t...

How do I define an empty table of unknown size?

Sorry, variables that do not exist do not have any datatype. As you add variables to the table, the datatype associated with t...

7 days ago | 0

Answered

upper case need help

str=char(mod(double(lower(str))-97+shift,26)+97);

upper case need help

str=char(mod(double(lower(str))-97+shift,26)+97);

7 days ago | 0

| accepted

Answered

Saving and loading matrices with vpa entries with save and load commands is extremely slow

You are correct, this can happen. The slowdown is inside the symbolic engine, when it is asked to convert into a character repre...

Saving and loading matrices with vpa entries with save and load commands is extremely slow

You are correct, this can happen. The slowdown is inside the symbolic engine, when it is asked to convert into a character repre...

7 days ago | 0

Answered

How to extract the events which have more than 3 consecutive rows

r=3; how many repeats mask = idx3.' == 2; %row starts = strfind([false mask], [0 ones(1,r)]; stops = strfind([mask, ...

How to extract the events which have more than 3 consecutive rows

r=3; how many repeats mask = idx3.' == 2; %row starts = strfind([false mask], [0 ones(1,r)]; stops = strfind([mask, ...

7 days ago | 1

| accepted

Answered

Error detected but matlab did not specify the type of error. pls help out

m25 = Mb.*Nb(1-(0.5.*(c4(i)+c4(i+1))))-((1-(0.5.*(c1(i)+c1(i+1)))).*beta1.*(x2(i)+h2.*m12)+(1-c2(i)+c2(i+1)).*beta2.*(x3(i)+h2...

Error detected but matlab did not specify the type of error. pls help out

m25 = Mb.*Nb(1-(0.5.*(c4(i)+c4(i+1))))-((1-(0.5.*(c1(i)+c1(i+1)))).*beta1.*(x2(i)+h2.*m12)+(1-c2(i)+c2(i+1)).*beta2.*(x3(i)+h2...

7 days ago | 0

Answered

about random number and matrix

R1=a*[0:n-1]; R2=b*[0:n-1]; R2=rand(1, 1, 100000)+R2.'; % add rand to every element in R2 del=R1-R2 ; % "row vector-column ...

about random number and matrix

R1=a*[0:n-1]; R2=b*[0:n-1]; R2=rand(1, 1, 100000)+R2.'; % add rand to every element in R2 del=R1-R2 ; % "row vector-column ...

7 days ago | 0

Answered

Question about hard coding error

Suppose that you are required to build a function f(x,y), and you happen know it will be called with y = 19, but you write the c...

Question about hard coding error

Suppose that you are required to build a function f(x,y), and you happen know it will be called with y = 19, but you write the c...

7 days ago | 0

Answered

subset the plot for the subset of x range

See isbetween() or use find(date_vector < last_date_to_plot, 1, 'last') in order to find the end of the group. In the special c...

subset the plot for the subset of x range

See isbetween() or use find(date_vector < last_date_to_plot, 1, 'last') in order to find the end of the group. In the special c...

7 days ago | 0

Answered

How to read the name of all output argument in function?

In order to do this, you need to use dbstack('-completenames') to find out the name of the file that you were called from and th...

How to read the name of all output argument in function?

In order to do this, you need to use dbstack('-completenames') to find out the name of the file that you were called from and th...

7 days ago | 0

Answered

function or functions of a single variable

fplot('-exp(-x)+x.^2-2*x+2',[0 1]) As far as fplot() is concerned, e is just another variable, and not the base of the natural ...

function or functions of a single variable

fplot('-exp(-x)+x.^2-2*x+2',[0 1]) As far as fplot() is concerned, e is just another variable, and not the base of the natural ...

7 days ago | 1

Answered

convert alphabet to coresponding number by using ASCII

UpperToLower = @(c) char(c-'A'+'a') Or if you are daring, UpperToLower = @(c) char(c+32);

convert alphabet to coresponding number by using ASCII

UpperToLower = @(c) char(c-'A'+'a') Or if you are daring, UpperToLower = @(c) char(c+32);

7 days ago | 0

Answered

Use Matlab R2019a to solve integer programing , why I get warning that selection function is ignored?

When you use integer constraints then ga() implements that by using its own creation function and selection function. If you ...

Use Matlab R2019a to solve integer programing , why I get warning that selection function is ignored?

When you use integer constraints then ga() implements that by using its own creation function and selection function. If you ...

7 days ago | 0

Answered

How to reduce computation time

By going back and replacing that 1000 limit with infinity, and adding the assumption that all values are non-negative, and that ...

How to reduce computation time

By going back and replacing that 1000 limit with infinity, and adding the assumption that all values are non-negative, and that ...

7 days ago | 0

| accepted

Answered

Finding set of variables that make my function approach zero

x(1) = 0.00001 x(3) = x(1) x(2) = 0.00000058171249020241154476633048977861 x(4) = x(2) f will be 0 to within round-off Th...

Finding set of variables that make my function approach zero

x(1) = 0.00001 x(3) = x(1) x(2) = 0.00000058171249020241154476633048977861 x(4) = x(2) f will be 0 to within round-off Th...

7 days ago | 0

Answered

Split Data in Character Array into Matrix

temp = regexp( cellstr(sample), '"(?<date>)[^"])"\s+(?<col2>\S+)\s+(?<col3>\S+)\s+(?<col3>\S+)\s+(?<col4>\S+)\s+(?<col5>\S+)\s+(...

Split Data in Character Array into Matrix

temp = regexp( cellstr(sample), '"(?<date>)[^"])"\s+(?<col2>\S+)\s+(?<col3>\S+)\s+(?<col3>\S+)\s+(?<col4>\S+)\s+(?<col5>\S+)\s+(...

8 days ago | 1

| accepted

Answered

Repetition of random numbers for variables with different length

random number generation is done down columns, so with (2,2) the order would be 1 3 2 4 When you then use (1,2) then the ...

Repetition of random numbers for variables with different length

random number generation is done down columns, so with (2,2) the order would be 1 3 2 4 When you then use (1,2) then the ...

8 days ago | 0

Answered

How can I access the numerical vector in a sym variable equation for future use in my program as a numerical value?

In this situation, rhs(x1) For future use, see also children()

How can I access the numerical vector in a sym variable equation for future use in my program as a numerical value?

In this situation, rhs(x1) For future use, see also children()

8 days ago | 1

Answered

SURF plot: Data dimensions must agree

dataset=xlsread('import.xlsx'); x = dataset(2:end,1); y = dataset(1,2:end); Z = dataset(2:end,2:end); surf(x, y, Z.', 'edgec...

SURF plot: Data dimensions must agree

dataset=xlsread('import.xlsx'); x = dataset(2:end,1); y = dataset(1,2:end); Z = dataset(2:end,2:end); surf(x, y, Z.', 'edgec...

8 days ago | 0

| accepted

Answered

Im trying to solve an equation that have variable on left and right side

depth= 1385.33 por=0.153 Qv=0.980 B=3200 Rw=0.265 m=1.86 n=2.2 Rt=4.05 F = @(Sw) (Sw) - ((Rw/((por^m)*Rt*(1+(B*Qv*Rw)/Sw...

Im trying to solve an equation that have variable on left and right side

depth= 1385.33 por=0.153 Qv=0.980 B=3200 Rw=0.265 m=1.86 n=2.2 Rt=4.05 F = @(Sw) (Sw) - ((Rw/((por^m)*Rt*(1+(B*Qv*Rw)/Sw...

9 days ago | 0

Answered

Solve/fsolve system of equations with exp, and multiple variables.

Your d_H_tf_C(tf)==0 turns out to be a differential equation involving x(tf) . You can solve the remaining 4 equations to derive...

Solve/fsolve system of equations with exp, and multiple variables.

Your d_H_tf_C(tf)==0 turns out to be a differential equation involving x(tf) . You can solve the remaining 4 equations to derive...

9 days ago | 0

| accepted